// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROMEOS_UI_FRAME_DEFAULT_FRAME_HEADER_H_
#define CHROMEOS_UI_FRAME_DEFAULT_FRAME_HEADER_H_

#include <optional>

#include "base/compiler_specific.h"  // override
#include "base/component_export.h"
#include "base/gtest_prod_util.h"
#include "chromeos/ui/base/chromeos_ui_constants.h"
#include "chromeos/ui/frame/frame_header.h"

namespace ash {
FORWARD_DECLARE_TEST(DefaultFrameHeaderTest, FrameColors);
FORWARD_DECLARE_TEST(FrameViewAshFrameColorTest, WideFrameInitialColor);
}  // namespace ash

namespace chromeos {

// Helper class for managing the default window header, which is used for
// Chrome apps (but not bookmark apps), for example.
class COMPONENT_EXPORT(CHROMEOS_UI_FRAME) DefaultFrameHeader
    : public FrameHeader {
 public:
  // DefaultFrameHeader does not take ownership of any of the parameters.
  DefaultFrameHeader(
      views::Widget* target_widget,
      views::View* header_view,
      chromeos::FrameCaptionButtonContainerView* caption_button_container);

  DefaultFrameHeader(const DefaultFrameHeader&) = delete;
  DefaultFrameHeader& operator=(const DefaultFrameHeader&) = delete;

  ~DefaultFrameHeader() override;

  void SetWidthInPixels(std::optional<int> width_in_pixels);
  std::optional<int> width_in_pixels() const { return width_in_pixels_; }

  // FrameHeader:
  void UpdateFrameColors() override;
  views::CaptionButtonLayoutSize GetButtonLayoutSize() const override;

 protected:
  // FrameHeader:
  void DoPaintHeader(gfx::Canvas* canvas) override;
  SkColor GetTitleColor() const override;
  SkColor GetCurrentFrameColor() const override;

 private:
  FRIEND_TEST_ALL_PREFIXES(ash::DefaultFrameHeaderTest, FrameColors);
  FRIEND_TEST_ALL_PREFIXES(ash::FrameViewAshFrameColorTest,
                           WideFrameInitialColor);

  // Returns the window of the target widget.
  aura::Window* GetTargetWindow();

  SkColor active_frame_color_ = chromeos::kDefaultFrameColor;
  SkColor inactive_frame_color_ = chromeos::kDefaultFrameColor;

  std::optional<int> width_in_pixels_;
};

}  // namespace chromeos

#endif  // CHROMEOS_UI_FRAME_DEFAULT_FRAME_HEADER_H_
