Commit 66286552 authored by Christopher Lam's avatar Christopher Lam Committed by Commit Bot

Rename ash::HeaderPainter to FrameHeader.

This CL renames the HeaderPainter because it does much more than
painting which has become confusing. This is a precursor CL to
https://chromium-review.googlesource.com/c/chromium/src/+/768601.

Bug: 762401
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_dbg_ng
Change-Id: Ie41fa68c8b4559e258eac6eee957cc059794bd96
Reviewed-on: https://chromium-review.googlesource.com/774058Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Commit-Queue: calamity <calamity@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517265}
parent 177b8e6b
......@@ -174,13 +174,13 @@ component("ash") {
"frame/caption_buttons/frame_size_button_delegate.h",
"frame/custom_frame_view_ash.cc",
"frame/custom_frame_view_ash.h",
"frame/default_header_painter.cc",
"frame/default_header_painter.h",
"frame/default_frame_header.cc",
"frame/default_frame_header.h",
"frame/frame_border_hit_test.cc",
"frame/frame_border_hit_test.h",
"frame/header_painter.h",
"frame/header_painter_util.cc",
"frame/header_painter_util.h",
"frame/frame_header.h",
"frame/frame_header_util.cc",
"frame/frame_header_util.h",
"frame/header_view.cc",
"frame/header_view.h",
"high_contrast/high_contrast_controller.cc",
......@@ -1281,7 +1281,7 @@ test("ash_unittests") {
"frame/caption_buttons/frame_caption_button_container_view_unittest.cc",
"frame/caption_buttons/frame_size_button_unittest.cc",
"frame/custom_frame_view_ash_unittest.cc",
"frame/default_header_painter_unittest.cc",
"frame/default_frame_header_unittest.cc",
"highlighter/highlighter_controller_unittest.cc",
"highlighter/highlighter_gesture_util_unittest.cc",
"ime/ime_controller_unittest.cc",
......
......@@ -2,13 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_FRAME_DEFAULT_HEADER_PAINTER_H_
#define ASH_FRAME_DEFAULT_HEADER_PAINTER_H_
#ifndef ASH_FRAME_DEFAULT_FRAME_HEADER_H_
#define ASH_FRAME_DEFAULT_FRAME_HEADER_H_
#include <memory>
#include "ash/ash_export.h"
#include "ash/frame/header_painter.h"
#include "ash/frame/frame_header.h"
#include "ash/public/interfaces/window_style.mojom.h"
#include "base/compiler_specific.h" // override
#include "base/gtest_prod_util.h"
......@@ -19,31 +19,31 @@
namespace gfx {
class Rect;
class SlideAnimation;
}
} // namespace gfx
namespace views {
class View;
class Widget;
}
} // namespace views
namespace ash {
class FrameCaptionButton;
class FrameCaptionButtonContainerView;
// Helper class for painting the default window header.
class ASH_EXPORT DefaultHeaderPainter : public HeaderPainter,
public gfx::AnimationDelegate {
// Helper class for managing the default window header.
class ASH_EXPORT DefaultFrameHeader : public FrameHeader,
public gfx::AnimationDelegate {
public:
explicit DefaultHeaderPainter(
explicit DefaultFrameHeader(
mojom::WindowStyle window_style = mojom::WindowStyle::DEFAULT);
~DefaultHeaderPainter() override;
~DefaultFrameHeader() override;
// DefaultHeaderPainter does not take ownership of any of the parameters.
// DefaultFrameHeader does not take ownership of any of the parameters.
void Init(views::Widget* frame,
views::View* header_view,
FrameCaptionButtonContainerView* caption_button_container,
FrameCaptionButton* back_button);
// HeaderPainter overrides:
// FrameHeader overrides:
int GetMinimumHeaderWidth() const override;
void PaintHeader(gfx::Canvas* canvas, Mode mode) override;
void LayoutHeader() override;
......@@ -74,9 +74,9 @@ class ASH_EXPORT DefaultHeaderPainter : public HeaderPainter,
bool ShouldUseLightImages() const;
private:
FRIEND_TEST_ALL_PREFIXES(DefaultHeaderPainterTest, BackButtonAlignment);
FRIEND_TEST_ALL_PREFIXES(DefaultHeaderPainterTest, TitleIconAlignment);
FRIEND_TEST_ALL_PREFIXES(DefaultHeaderPainterTest, LightIcons);
FRIEND_TEST_ALL_PREFIXES(DefaultFrameHeaderTest, BackButtonAlignment);
FRIEND_TEST_ALL_PREFIXES(DefaultFrameHeaderTest, TitleIconAlignment);
FRIEND_TEST_ALL_PREFIXES(DefaultFrameHeaderTest, LightIcons);
// gfx::AnimationDelegate override:
void AnimationProgressed(const gfx::Animation* animation) override;
......@@ -128,9 +128,9 @@ class ASH_EXPORT DefaultHeaderPainter : public HeaderPainter,
std::unique_ptr<gfx::SlideAnimation> activation_animation_;
DISALLOW_COPY_AND_ASSIGN(DefaultHeaderPainter);
DISALLOW_COPY_AND_ASSIGN(DefaultFrameHeader);
};
} // namespace ash
#endif // ASH_FRAME_DEFAULT_HEADER_PAINTER_H_
#endif // ASH_FRAME_DEFAULT_FRAME_HEADER_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/frame/default_header_painter.h"
#include "ash/frame/default_frame_header.h"
#include <memory>
......@@ -14,16 +14,16 @@
#include "ui/views/widget/widget.h"
#include "ui/views/window/non_client_view.h"
using ash::HeaderPainter;
using ash::FrameHeader;
using views::NonClientFrameView;
using views::Widget;
namespace ash {
using DefaultHeaderPainterTest = AshTestBase;
using DefaultFrameHeaderTest = AshTestBase;
// Ensure the title text is vertically aligned with the window icon.
TEST_F(DefaultHeaderPainterTest, TitleIconAlignment) {
TEST_F(DefaultFrameHeaderTest, TitleIconAlignment) {
std::unique_ptr<Widget> w = CreateTestWidget(
nullptr, kShellWindowId_DefaultContainer, gfx::Rect(1, 2, 3, 4));
ash::FrameCaptionButtonContainerView container(w.get());
......@@ -32,28 +32,28 @@ TEST_F(DefaultHeaderPainterTest, TitleIconAlignment) {
w->SetBounds(gfx::Rect(0, 0, 500, 500));
w->Show();
DefaultHeaderPainter painter;
painter.Init(w.get(), w->non_client_view()->frame_view(), &container,
nullptr);
painter.UpdateLeftHeaderView(&window_icon);
painter.LayoutHeader();
gfx::Rect title_bounds = painter.GetTitleBounds();
DefaultFrameHeader frame_header;
frame_header.Init(w.get(), w->non_client_view()->frame_view(), &container,
nullptr);
frame_header.UpdateLeftHeaderView(&window_icon);
frame_header.LayoutHeader();
gfx::Rect title_bounds = frame_header.GetTitleBounds();
EXPECT_EQ(window_icon.bounds().CenterPoint().y(),
title_bounds.CenterPoint().y());
}
TEST_F(DefaultHeaderPainterTest, BackButtonAlignment) {
TEST_F(DefaultFrameHeaderTest, BackButtonAlignment) {
std::unique_ptr<Widget> w = CreateTestWidget(
nullptr, kShellWindowId_DefaultContainer, gfx::Rect(1, 2, 3, 4));
ash::FrameCaptionButtonContainerView container(w.get());
ash::FrameBackButton back;
DefaultHeaderPainter painter;
painter.Init(w.get(), w->non_client_view()->frame_view(), &container,
nullptr);
painter.UpdateBackButton(&back);
painter.LayoutHeader();
gfx::Rect title_bounds = painter.GetTitleBounds();
DefaultFrameHeader frame_header;
frame_header.Init(w.get(), w->non_client_view()->frame_view(), &container,
nullptr);
frame_header.UpdateBackButton(&back);
frame_header.LayoutHeader();
gfx::Rect title_bounds = frame_header.GetTitleBounds();
// The back button should be positioned at the left edge, and
// vertically centered.
EXPECT_EQ(back.bounds().CenterPoint().y(), title_bounds.CenterPoint().y());
......@@ -61,7 +61,7 @@ TEST_F(DefaultHeaderPainterTest, BackButtonAlignment) {
}
// Ensure the light icons are used when appropriate.
TEST_F(DefaultHeaderPainterTest, LightIcons) {
TEST_F(DefaultFrameHeaderTest, LightIcons) {
std::unique_ptr<Widget> w = CreateTestWidget(
nullptr, kShellWindowId_DefaultContainer, gfx::Rect(1, 2, 3, 4));
ash::FrameCaptionButtonContainerView container(w.get());
......@@ -70,37 +70,38 @@ TEST_F(DefaultHeaderPainterTest, LightIcons) {
w->SetBounds(gfx::Rect(0, 0, 500, 500));
w->Show();
DefaultHeaderPainter painter;
painter.Init(w.get(), w->non_client_view()->frame_view(), &container,
nullptr);
DefaultFrameHeader frame_header;
frame_header.Init(w.get(), w->non_client_view()->frame_view(), &container,
nullptr);
// Check by default light icons are not used.
painter.mode_ = HeaderPainter::MODE_ACTIVE;
EXPECT_FALSE(painter.ShouldUseLightImages());
painter.mode_ = HeaderPainter::MODE_INACTIVE;
EXPECT_FALSE(painter.ShouldUseLightImages());
frame_header.mode_ = FrameHeader::MODE_ACTIVE;
EXPECT_FALSE(frame_header.ShouldUseLightImages());
frame_header.mode_ = FrameHeader::MODE_INACTIVE;
EXPECT_FALSE(frame_header.ShouldUseLightImages());
// Check that setting dark colors should use light icons.
painter.SetFrameColors(SkColorSetRGB(0, 0, 0), SkColorSetRGB(0, 0, 0));
painter.mode_ = HeaderPainter::MODE_ACTIVE;
EXPECT_TRUE(painter.ShouldUseLightImages());
painter.mode_ = HeaderPainter::MODE_INACTIVE;
EXPECT_TRUE(painter.ShouldUseLightImages());
frame_header.SetFrameColors(SkColorSetRGB(0, 0, 0), SkColorSetRGB(0, 0, 0));
frame_header.mode_ = FrameHeader::MODE_ACTIVE;
EXPECT_TRUE(frame_header.ShouldUseLightImages());
frame_header.mode_ = FrameHeader::MODE_INACTIVE;
EXPECT_TRUE(frame_header.ShouldUseLightImages());
// Check that inactive and active colors are used properly.
painter.SetFrameColors(SkColorSetRGB(0, 0, 0), SkColorSetRGB(255, 255, 255));
painter.mode_ = HeaderPainter::MODE_ACTIVE;
EXPECT_TRUE(painter.ShouldUseLightImages());
painter.mode_ = HeaderPainter::MODE_INACTIVE;
EXPECT_FALSE(painter.ShouldUseLightImages());
frame_header.SetFrameColors(SkColorSetRGB(0, 0, 0),
SkColorSetRGB(255, 255, 255));
frame_header.mode_ = FrameHeader::MODE_ACTIVE;
EXPECT_TRUE(frame_header.ShouldUseLightImages());
frame_header.mode_ = FrameHeader::MODE_INACTIVE;
EXPECT_FALSE(frame_header.ShouldUseLightImages());
// Check not so light or dark colors.
painter.SetFrameColors(SkColorSetRGB(70, 70, 70),
SkColorSetRGB(200, 200, 200));
painter.mode_ = HeaderPainter::MODE_ACTIVE;
EXPECT_TRUE(painter.ShouldUseLightImages());
painter.mode_ = HeaderPainter::MODE_INACTIVE;
EXPECT_FALSE(painter.ShouldUseLightImages());
frame_header.SetFrameColors(SkColorSetRGB(70, 70, 70),
SkColorSetRGB(200, 200, 200));
frame_header.mode_ = FrameHeader::MODE_ACTIVE;
EXPECT_TRUE(frame_header.ShouldUseLightImages());
frame_header.mode_ = FrameHeader::MODE_INACTIVE;
EXPECT_FALSE(frame_header.ShouldUseLightImages());
}
} // namespace ash
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_FRAME_HEADER_PAINTER_H_
#define ASH_FRAME_HEADER_PAINTER_H_
#ifndef ASH_FRAME_FRAME_HEADER_H_
#define ASH_FRAME_FRAME_HEADER_H_
#include "ash/ash_export.h"
......@@ -13,12 +13,12 @@ class Canvas;
namespace ash {
// Helper class for painting the window header.
class ASH_EXPORT HeaderPainter {
// Helper class for managing the window header.
class ASH_EXPORT FrameHeader {
public:
enum Mode { MODE_ACTIVE, MODE_INACTIVE };
virtual ~HeaderPainter() {}
virtual ~FrameHeader() {}
// Returns the header's minimum width.
virtual int GetMinimumHeaderWidth() const = 0;
......@@ -41,11 +41,11 @@ class ASH_EXPORT HeaderPainter {
// Schedule a re-paint of the entire title.
virtual void SchedulePaintForTitle() = 0;
// True to instruct the painter to paint the header as an active
// True to instruct the frame header to paint the header as an active
// state.
virtual void SetPaintAsActive(bool paint_as_active) = 0;
};
} // namespace ash
#endif // ASH_FRAME_HEADER_PAINTER_H_
#endif // ASH_FRAME_FRAME_HEADER_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/frame/header_painter_util.h"
#include "ash/frame/frame_header_util.h"
#include <algorithm>
......@@ -44,22 +44,22 @@ const int kThemeFrameImageInsetX = 5;
namespace ash {
// static
int HeaderPainterUtil::GetTopCornerRadiusWhenRestored() {
int FrameHeaderUtil::GetTopCornerRadiusWhenRestored() {
return kTopCornerRadiusWhenRestored;
}
// static
int HeaderPainterUtil::GetLeftViewXInset() {
int FrameHeaderUtil::GetLeftViewXInset() {
return kLeftViewXInset;
}
// static
int HeaderPainterUtil::GetThemeBackgroundXInset() {
int FrameHeaderUtil::GetThemeBackgroundXInset() {
return kThemeFrameImageInsetX;
}
// static
gfx::Rect HeaderPainterUtil::GetTitleBounds(
gfx::Rect FrameHeaderUtil::GetTitleBounds(
const views::View* left_view,
const views::View* right_view,
const gfx::FontList& title_font_list) {
......@@ -74,10 +74,10 @@ gfx::Rect HeaderPainterUtil::GetTitleBounds(
}
// static
bool HeaderPainterUtil::CanAnimateActivation(views::Widget* widget) {
bool FrameHeaderUtil::CanAnimateActivation(views::Widget* widget) {
// Do not animate the header if the parent (e.g.
// kShellWindowId_DefaultContainer) is already animating. All of the
// implementers of HeaderPainter animate activation by continuously painting
// implementers of FrameHeader animate activation by continuously painting
// during the animation. This gives the parent's animation a slower frame
// rate.
// TODO(sky): Expose a better way to determine this rather than assuming the
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_FRAME_HEADER_PAINTER_UTIL_H_
#define ASH_FRAME_HEADER_PAINTER_UTIL_H_
#ifndef ASH_FRAME_FRAME_HEADER_UTIL_H_
#define ASH_FRAME_FRAME_HEADER_UTIL_H_
#include "ash/ash_export.h"
#include "base/macros.h"
......@@ -11,17 +11,17 @@
namespace gfx {
class FontList;
class Rect;
}
} // namespace gfx
namespace views {
class View;
class Widget;
}
} // namespace views
namespace ash {
// Static-only helper class for functionality used across multiple
// implementations of HeaderPainter.
class ASH_EXPORT HeaderPainterUtil {
// implementations of FrameHeader.
class ASH_EXPORT FrameHeaderUtil {
public:
// Returns the radius of the header's corners when the window is restored.
static int GetTopCornerRadiusWhenRestored();
......@@ -47,9 +47,9 @@ class ASH_EXPORT HeaderPainterUtil {
static bool CanAnimateActivation(views::Widget* widget);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(HeaderPainterUtil);
DISALLOW_IMPLICIT_CONSTRUCTORS(FrameHeaderUtil);
};
} // namespace ash
#endif // ASH_FRAME_HEADER_PAINTER_UTIL_H_
#endif // ASH_FRAME_FRAME_HEADER_UTIL_H_
......@@ -9,7 +9,7 @@
#include "ash/frame/caption_buttons/frame_back_button.h"
#include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
#include "ash/frame/custom_frame_view_ash.h"
#include "ash/frame/default_header_painter.h"
#include "ash/frame/default_frame_header.h"
#include "ash/shell.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "ash/wm/window_state.h"
......@@ -21,7 +21,7 @@ namespace ash {
HeaderView::HeaderView(views::Widget* target_widget,
mojom::WindowStyle window_style)
: target_widget_(target_widget),
header_painter_(std::make_unique<DefaultHeaderPainter>(window_style)),
frame_header_(std::make_unique<DefaultFrameHeader>(window_style)),
avatar_icon_(nullptr),
caption_button_container_(nullptr),
fullscreen_visible_fraction_(0),
......@@ -31,8 +31,7 @@ HeaderView::HeaderView(views::Widget* target_widget,
caption_button_container_->UpdateSizeButtonVisibility();
AddChildView(caption_button_container_);
header_painter_->Init(target_widget_, this, caption_button_container_,
nullptr);
frame_header_->Init(target_widget_, this, caption_button_container_, nullptr);
Shell::Get()->tablet_mode_controller()->AddObserver(this);
}
......@@ -43,7 +42,7 @@ HeaderView::~HeaderView() {
}
void HeaderView::SchedulePaintForTitle() {
header_painter_->SchedulePaintForTitle();
frame_header_->SchedulePaintForTitle();
}
void HeaderView::ResetWindowControls() {
......@@ -68,11 +67,11 @@ int HeaderView::GetPreferredHeight() {
// Calculating the preferred height requires at least one Layout().
if (!did_layout_)
Layout();
return header_painter_->GetHeaderHeightForPainting();
return frame_header_->GetHeaderHeightForPainting();
}
int HeaderView::GetMinimumWidth() const {
return header_painter_->GetMinimumHeaderWidth();
return frame_header_->GetMinimumHeaderWidth();
}
void HeaderView::SetAvatarIcon(const gfx::ImageSkia& avatar) {
......@@ -90,7 +89,7 @@ void HeaderView::SetAvatarIcon(const gfx::ImageSkia& avatar) {
}
avatar_icon_->SetImage(avatar);
}
header_painter_->UpdateLeftHeaderView(avatar_icon_);
frame_header_->UpdateLeftHeaderView(avatar_icon_);
Layout();
}
......@@ -105,7 +104,7 @@ void HeaderView::SetBackButtonState(FrameBackButtonState state) {
delete back_button_;
back_button_ = nullptr;
}
header_painter_->UpdateBackButton(back_button_);
frame_header_->UpdateBackButton(back_button_);
Layout();
}
......@@ -117,15 +116,15 @@ void HeaderView::SizeConstraintsChanged() {
void HeaderView::SetFrameColors(SkColor active_frame_color,
SkColor inactive_frame_color) {
header_painter_->SetFrameColors(active_frame_color, inactive_frame_color);
frame_header_->SetFrameColors(active_frame_color, inactive_frame_color);
}
SkColor HeaderView::GetActiveFrameColor() const {
return header_painter_->GetActiveFrameColor();
return frame_header_->GetActiveFrameColor();
}
SkColor HeaderView::GetInactiveFrameColor() const {
return header_painter_->GetInactiveFrameColor();
return frame_header_->GetInactiveFrameColor();
}
///////////////////////////////////////////////////////////////////////////////
......@@ -134,8 +133,8 @@ SkColor HeaderView::GetInactiveFrameColor() const {
void HeaderView::Layout() {
did_layout_ = true;
if (back_button_)
back_button_->set_use_light_images(header_painter_->ShouldUseLightImages());
header_painter_->LayoutHeader();
back_button_->set_use_light_images(frame_header_->ShouldUseLightImages());
frame_header_->LayoutHeader();
}
void HeaderView::OnPaint(gfx::Canvas* canvas) {
......@@ -144,12 +143,11 @@ void HeaderView::OnPaint(gfx::Canvas* canvas) {
bool paint_as_active =
target_widget_->non_client_view()->frame_view()->ShouldPaintAsActive();
header_painter_->SetPaintAsActive(paint_as_active);
frame_header_->SetPaintAsActive(paint_as_active);
HeaderPainter::Mode header_mode = paint_as_active
? HeaderPainter::MODE_ACTIVE
: HeaderPainter::MODE_INACTIVE;
header_painter_->PaintHeader(canvas, header_mode);
FrameHeader::Mode header_mode =
paint_as_active ? FrameHeader::MODE_ACTIVE : FrameHeader::MODE_INACTIVE;
frame_header_->PaintHeader(canvas, header_mode);
}
void HeaderView::ChildPreferredSizeChanged(views::View* child) {
......
......@@ -26,7 +26,7 @@ class Widget;
namespace ash {
class DefaultHeaderPainter;
class DefaultFrameHeader;
class FrameCaptionButton;
class FrameCaptionButtonContainerView;
enum class FrameBackButtonState;
......@@ -106,7 +106,7 @@ class ASH_EXPORT HeaderView : public views::View,
views::Widget* target_widget_;
// Helper for painting the header.
std::unique_ptr<DefaultHeaderPainter> header_painter_;
std::unique_ptr<DefaultFrameHeader> frame_header_;
views::ImageView* avatar_icon_;
......
......@@ -5,7 +5,7 @@
#include "ash/wm/panels/panel_frame_view.h"
#include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
#include "ash/frame/default_header_painter.h"
#include "ash/frame/default_frame_header.h"
#include "ash/frame/frame_border_hit_test.h"
#include "ash/shell.h"
#include "ash/wm/resize_handle_window_targeter.h"
......@@ -28,7 +28,7 @@ PanelFrameView::PanelFrameView(views::Widget* frame, FrameType frame_type)
wm::InstallResizeHandleWindowTargeterForWindow(GetWidgetWindow(), nullptr);
DCHECK(!frame_->widget_delegate()->CanMaximize());
if (frame_type != FRAME_NONE)
InitHeaderPainter();
InitFrameHeader();
Shell::Get()->AddShellObserver(this);
}
......@@ -38,29 +38,29 @@ PanelFrameView::~PanelFrameView() {
void PanelFrameView::SetFrameColors(SkColor active_frame_color,
SkColor inactive_frame_color) {
header_painter_->SetFrameColors(active_frame_color, inactive_frame_color);
frame_header_->SetFrameColors(active_frame_color, inactive_frame_color);
GetWidgetWindow()->SetProperty(aura::client::kTopViewColor,
header_painter_->GetInactiveFrameColor());
frame_header_->GetInactiveFrameColor());
}
const char* PanelFrameView::GetClassName() const {
return kViewClassName;
}
void PanelFrameView::InitHeaderPainter() {
header_painter_.reset(new DefaultHeaderPainter);
void PanelFrameView::InitFrameHeader() {
frame_header_.reset(new DefaultFrameHeader);
GetWidgetWindow()->SetProperty(aura::client::kTopViewColor,
header_painter_->GetInactiveFrameColor());
frame_header_->GetInactiveFrameColor());
caption_button_container_ = new FrameCaptionButtonContainerView(frame_);
AddChildView(caption_button_container_);
header_painter_->Init(frame_, this, caption_button_container_, nullptr);
frame_header_->Init(frame_, this, caption_button_container_, nullptr);
if (frame_->widget_delegate()->ShouldShowWindowIcon()) {
window_icon_ = new views::ImageView();
AddChildView(window_icon_);
header_painter_->UpdateLeftHeaderView(window_icon_);
frame_header_->UpdateLeftHeaderView(window_icon_);
}
}
......@@ -69,24 +69,24 @@ aura::Window* PanelFrameView::GetWidgetWindow() {
}
int PanelFrameView::NonClientTopBorderHeight() const {
if (!header_painter_)
if (!frame_header_)
return 0;
return header_painter_->GetHeaderHeightForPainting();
return frame_header_->GetHeaderHeightForPainting();
}
gfx::Size PanelFrameView::GetMinimumSize() const {
if (!header_painter_)
if (!frame_header_)
return gfx::Size();
gfx::Size min_client_view_size(frame_->client_view()->GetMinimumSize());
return gfx::Size(std::max(header_painter_->GetMinimumHeaderWidth(),
return gfx::Size(std::max(frame_header_->GetMinimumHeaderWidth(),
min_client_view_size.width()),
NonClientTopBorderHeight() + min_client_view_size.height());
}
void PanelFrameView::Layout() {
if (!header_painter_)
if (!frame_header_)
return;
header_painter_->LayoutHeader();
frame_header_->LayoutHeader();
GetWidgetWindow()->SetProperty(aura::client::kTopViewInset,
NonClientTopBorderHeight());
}
......@@ -109,9 +109,9 @@ void PanelFrameView::UpdateWindowIcon() {
}
void PanelFrameView::UpdateWindowTitle() {
if (!header_painter_)
if (!frame_header_)
return;
header_painter_->SchedulePaintForTitle();
frame_header_->SchedulePaintForTitle();
}
void PanelFrameView::SizeConstraintsChanged() {}
......@@ -130,22 +130,21 @@ gfx::Rect PanelFrameView::GetWindowBoundsForClientBounds(
}
int PanelFrameView::NonClientHitTest(const gfx::Point& point) {
if (!header_painter_)
if (!frame_header_)
return HTNOWHERE;
return FrameBorderNonClientHitTest(this, nullptr, caption_button_container_,
point);
}
void PanelFrameView::OnPaint(gfx::Canvas* canvas) {
if (!header_painter_)
if (!frame_header_)
return;
bool paint_as_active = ShouldPaintAsActive();
caption_button_container_->SetPaintAsActive(paint_as_active);
HeaderPainter::Mode header_mode = paint_as_active
? HeaderPainter::MODE_ACTIVE
: HeaderPainter::MODE_INACTIVE;
header_painter_->PaintHeader(canvas, header_mode);
FrameHeader::Mode header_mode =
paint_as_active ? FrameHeader::MODE_ACTIVE : FrameHeader::MODE_INACTIVE;
frame_header_->PaintHeader(canvas, header_mode);
}
///////////////////////////////////////////////////////////////////////////////
......
......@@ -17,7 +17,7 @@ class ImageView;
}
namespace ash {
class DefaultHeaderPainter;
class DefaultFrameHeader;
class FrameCaptionButtonContainerView;
class ASH_EXPORT PanelFrameView : public views::NonClientFrameView,
......@@ -39,7 +39,7 @@ class ASH_EXPORT PanelFrameView : public views::NonClientFrameView,
const char* GetClassName() const override;
private:
void InitHeaderPainter();
void InitFrameHeader();
aura::Window* GetWidgetWindow();
......@@ -74,7 +74,7 @@ class ASH_EXPORT PanelFrameView : public views::NonClientFrameView,
gfx::Rect client_view_bounds_;
// Helper class for painting the header.
std::unique_ptr<DefaultHeaderPainter> header_painter_;
std::unique_ptr<DefaultFrameHeader> frame_header_;
DISALLOW_COPY_AND_ASSIGN(PanelFrameView);
};
......
......@@ -5,7 +5,7 @@ ash/accelerators/accelerator_controller_delegate.h
ash/accelerators/accelerator_controller_delegate_aura.h
ash/accelerators/accelerator_table.h
ash/ash_export.h
ash/frame/header_painter.h
ash/frame/frame_header.h
ash/metrics/task_switch_metrics_recorder.h
ash/metrics/task_switch_source.h
ash/metrics/user_metrics_action.h
......@@ -70,7 +70,7 @@ chrome/browser/ui/ash/ash_util.h
chrome/browser/ui/ash/multi_user/multi_user_util.h
chrome/browser/ui/network_profile_bubble.h
chrome/browser/ui/passwords/manage_passwords_icon.h
chrome/browser/ui/views/frame/browser_header_painter_ash.h
chrome/browser/ui/views/frame/browser_frame_header_ash.h
chrome/browser/ui/webui/large_icon_source.h
chrome/common/mac/app_shim_launch.h
chrome/common/mac/app_shim_messages.h
......
......@@ -1293,8 +1293,8 @@ split_static_library("ui") {
"views/extensions/request_file_system_dialog_view.h",
"views/frame/browser_frame_ash.cc",
"views/frame/browser_frame_ash.h",
"views/frame/browser_header_painter_ash.cc",
"views/frame/browser_header_painter_ash.h",
"views/frame/browser_frame_header_ash.cc",
"views/frame/browser_frame_header_ash.h",
"views/frame/browser_non_client_frame_view_ash.cc",
"views/frame/browser_non_client_frame_view_ash.h",
"views/frame/immersive_context_mus.cc",
......
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/views/frame/browser_header_painter_ash.h"
#include "chrome/browser/ui/views/frame/browser_frame_header_ash.h"
#include "ash/ash_layout_constants.h"
#include "ash/frame/caption_buttons/frame_caption_button.h"
#include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
#include "ash/frame/header_painter_util.h"
#include "ash/frame/frame_header_util.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "base/logging.h"
#include "chrome/browser/themes/theme_properties.h"
......@@ -47,11 +47,14 @@ SkPath MakeRoundRectPath(const gfx::Rect& bounds,
SkRect rect = gfx::RectToSkRect(bounds);
const SkScalar kTopLeftRadius = SkIntToScalar(top_left_corner_radius);
const SkScalar kTopRightRadius = SkIntToScalar(top_right_corner_radius);
SkScalar radii[8] = {
kTopLeftRadius, kTopLeftRadius, // top-left
kTopRightRadius, kTopRightRadius, // top-right
0, 0, // bottom-right
0, 0}; // bottom-left
SkScalar radii[8] = {kTopLeftRadius,
kTopLeftRadius, // top-left
kTopRightRadius,
kTopRightRadius, // top-right
0,
0, // bottom-right
0,
0}; // bottom-left
SkPath path;
path.addRoundRect(rect, radii, SkPath::kCW_Direction);
return path;
......@@ -103,9 +106,9 @@ void PaintFrameImagesInRoundRect(gfx::Canvas* canvas,
} // namespace
///////////////////////////////////////////////////////////////////////////////
// BrowserHeaderPainterAsh, public:
// BrowserFrameHeaderAsh, public:
BrowserHeaderPainterAsh::BrowserHeaderPainterAsh()
BrowserFrameHeaderAsh::BrowserFrameHeaderAsh()
: frame_(nullptr),
is_tabbed_(false),
is_incognito_(false),
......@@ -115,13 +118,11 @@ BrowserHeaderPainterAsh::BrowserHeaderPainterAsh()
painted_height_(0),
initial_paint_(true),
mode_(MODE_INACTIVE),
activation_animation_(new gfx::SlideAnimation(this)) {
}
activation_animation_(new gfx::SlideAnimation(this)) {}
BrowserHeaderPainterAsh::~BrowserHeaderPainterAsh() {
}
BrowserFrameHeaderAsh::~BrowserFrameHeaderAsh() {}
void BrowserHeaderPainterAsh::Init(
void BrowserFrameHeaderAsh::Init(
views::Widget* frame,
BrowserView* browser_view,
BrowserNonClientFrameViewAsh* header_view,
......@@ -150,20 +151,19 @@ void BrowserHeaderPainterAsh::Init(
back_button_->set_use_light_images(is_incognito_);
}
int BrowserHeaderPainterAsh::GetMinimumHeaderWidth() const {
int BrowserFrameHeaderAsh::GetMinimumHeaderWidth() const {
// Ensure we have enough space for the window icon and buttons. We allow
// the title string to collapse to zero width.
return GetTitleBounds().x() +
caption_button_container_->GetMinimumSize().width();
caption_button_container_->GetMinimumSize().width();
}
void BrowserHeaderPainterAsh::PaintHeader(gfx::Canvas* canvas, Mode mode) {
void BrowserFrameHeaderAsh::PaintHeader(gfx::Canvas* canvas, Mode mode) {
Mode old_mode = mode_;
mode_ = mode;
if (mode_ != old_mode) {
if (!initial_paint_ &&
ash::HeaderPainterUtil::CanAnimateActivation(frame_)) {
if (!initial_paint_ && ash::FrameHeaderUtil::CanAnimateActivation(frame_)) {
activation_animation_->SetSlideDuration(kActivationCrossfadeDurationMs);
if (mode_ == MODE_ACTIVE)
activation_animation_->Show();
......@@ -187,7 +187,7 @@ void BrowserHeaderPainterAsh::PaintHeader(gfx::Canvas* canvas, Mode mode) {
}
}
void BrowserHeaderPainterAsh::LayoutHeader() {
void BrowserFrameHeaderAsh::LayoutHeader() {
// Purposefully set |painted_height_| to an invalid value. We cannot use
// |painted_height_| because the computation of |painted_height_| may depend
// on having laid out the window controls.
......@@ -199,8 +199,7 @@ void BrowserHeaderPainterAsh::LayoutHeader() {
gfx::Size caption_button_container_size =
caption_button_container_->GetPreferredSize();
caption_button_container_->SetBounds(
view_->width() - caption_button_container_size.width(),
0,
view_->width() - caption_button_container_size.width(), 0,
caption_button_container_size.width(),
caption_button_container_size.height());
......@@ -208,32 +207,31 @@ void BrowserHeaderPainterAsh::LayoutHeader() {
// Vertically center the window icon with respect to the caption button
// container.
gfx::Size icon_size(window_icon_->GetPreferredSize());
int icon_offset_y = (caption_button_container_->height() -
icon_size.height()) / 2;
window_icon_->SetBounds(ash::HeaderPainterUtil::GetLeftViewXInset(),
icon_offset_y,
icon_size.width(),
int icon_offset_y =
(caption_button_container_->height() - icon_size.height()) / 2;
window_icon_->SetBounds(ash::FrameHeaderUtil::GetLeftViewXInset(),
icon_offset_y, icon_size.width(),
icon_size.height());
}
}
int BrowserHeaderPainterAsh::GetHeaderHeight() const {
int BrowserFrameHeaderAsh::GetHeaderHeight() const {
return caption_button_container_->height();
}
int BrowserHeaderPainterAsh::GetHeaderHeightForPainting() const {
int BrowserFrameHeaderAsh::GetHeaderHeightForPainting() const {
return painted_height_;
}
void BrowserHeaderPainterAsh::SetHeaderHeightForPainting(int height) {
void BrowserFrameHeaderAsh::SetHeaderHeightForPainting(int height) {
painted_height_ = height;
}
void BrowserHeaderPainterAsh::SchedulePaintForTitle() {
void BrowserFrameHeaderAsh::SchedulePaintForTitle() {
view_->SchedulePaintInRect(GetTitleBounds());
}
void BrowserHeaderPainterAsh::SetPaintAsActive(bool paint_as_active) {
void BrowserFrameHeaderAsh::SetPaintAsActive(bool paint_as_active) {
caption_button_container_->SetPaintAsActive(paint_as_active);
if (back_button_)
back_button_->set_paint_as_active(paint_as_active);
......@@ -242,16 +240,15 @@ void BrowserHeaderPainterAsh::SetPaintAsActive(bool paint_as_active) {
///////////////////////////////////////////////////////////////////////////////
// gfx::AnimationDelegate overrides:
void BrowserHeaderPainterAsh::AnimationProgressed(
void BrowserFrameHeaderAsh::AnimationProgressed(
const gfx::Animation* animation) {
view_->SchedulePaintInRect(GetPaintedBounds());
}
///////////////////////////////////////////////////////////////////////////////
// BrowserHeaderPainterAsh, private:
// BrowserFrameHeaderAsh, private:
void BrowserHeaderPainterAsh::PaintFrameImages(gfx::Canvas* canvas,
bool active) {
void BrowserFrameHeaderAsh::PaintFrameImages(gfx::Canvas* canvas, bool active) {
int alpha = activation_animation_->CurrentValueBetween(0, 0xFF);
if (!active)
alpha = 0xFF - alpha;
......@@ -265,15 +262,15 @@ void BrowserHeaderPainterAsh::PaintFrameImages(gfx::Canvas* canvas,
int corner_radius = 0;
if (!frame_->IsMaximized() && !frame_->IsFullscreen())
corner_radius = ash::HeaderPainterUtil::GetTopCornerRadiusWhenRestored();
corner_radius = ash::FrameHeaderUtil::GetTopCornerRadiusWhenRestored();
PaintFrameImagesInRoundRect(
canvas, frame_image, frame_overlay_image, alpha, background_color,
GetPaintedBounds(), corner_radius,
ash::HeaderPainterUtil::GetThemeBackgroundXInset());
PaintFrameImagesInRoundRect(canvas, frame_image, frame_overlay_image, alpha,
background_color, GetPaintedBounds(),
corner_radius,
ash::FrameHeaderUtil::GetThemeBackgroundXInset());
}
void BrowserHeaderPainterAsh::PaintTitleBar(gfx::Canvas* canvas) {
void BrowserFrameHeaderAsh::PaintTitleBar(gfx::Canvas* canvas) {
// The window icon is painted by its own views::View.
canvas->DrawStringRectWithFlags(frame_->widget_delegate()->GetWindowTitle(),
BrowserFrame::GetTitleFontList(),
......@@ -283,7 +280,7 @@ void BrowserHeaderPainterAsh::PaintTitleBar(gfx::Canvas* canvas) {
gfx::Canvas::NO_SUBPIXEL_RENDERING);
}
void BrowserHeaderPainterAsh::UpdateCaptionButtons() {
void BrowserFrameHeaderAsh::UpdateCaptionButtons() {
caption_button_container_->SetButtonImage(ash::CAPTION_BUTTON_ICON_MINIMIZE,
ash::kWindowControlMinimizeIcon);
caption_button_container_->SetButtonImage(ash::CAPTION_BUTTON_ICON_CLOSE,
......@@ -308,12 +305,12 @@ void BrowserHeaderPainterAsh::UpdateCaptionButtons() {
caption_button_container_->SetButtonSize(button_size);
}
gfx::Rect BrowserHeaderPainterAsh::GetPaintedBounds() const {
gfx::Rect BrowserFrameHeaderAsh::GetPaintedBounds() const {
return gfx::Rect(view_->width(), painted_height_);
}
gfx::Rect BrowserHeaderPainterAsh::GetTitleBounds() const {
gfx::Rect BrowserFrameHeaderAsh::GetTitleBounds() const {
views::View* left_view = window_icon_ ? window_icon_ : back_button_;
return ash::HeaderPainterUtil::GetTitleBounds(
return ash::FrameHeaderUtil::GetTitleBounds(
left_view, caption_button_container_, BrowserFrame::GetTitleFontList());
}
......@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_HEADER_PAINTER_ASH_H_
#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_HEADER_PAINTER_ASH_H_
#ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_HEADER_ASH_H_
#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_HEADER_ASH_H_
#include <memory>
#include "ash/frame/header_painter.h"
#include "ash/frame/frame_header.h"
#include "base/macros.h"
#include "ui/gfx/animation/animation_delegate.h"
......@@ -17,25 +17,25 @@ class BrowserView;
namespace ash {
class FrameCaptionButton;
class FrameCaptionButtonContainerView;
}
} // namespace ash
namespace gfx {
class Rect;
class SlideAnimation;
}
} // namespace gfx
namespace views {
class View;
class Widget;
}
} // namespace views
// Helper class for painting the browser window header.
class BrowserHeaderPainterAsh : public ash::HeaderPainter,
public gfx::AnimationDelegate {
// Helper class for managing the browser window header.
class BrowserFrameHeaderAsh : public ash::FrameHeader,
public gfx::AnimationDelegate {
public:
BrowserHeaderPainterAsh();
~BrowserHeaderPainterAsh() override;
BrowserFrameHeaderAsh();
~BrowserFrameHeaderAsh() override;
// BrowserHeaderPainterAsh does not take ownership of any of the parameters.
// BrowserFrameHeaderAsh does not take ownership of any of the parameters.
// |back_button| can be nullptr, and the frame will not have a back button.
void Init(views::Widget* frame,
BrowserView* browser_view,
......@@ -44,7 +44,7 @@ class BrowserHeaderPainterAsh : public ash::HeaderPainter,
ash::FrameCaptionButtonContainerView* caption_button_container,
ash::FrameCaptionButton* back_button);
// ash::HeaderPainter overrides:
// ash::FrameHeader overrides:
int GetMinimumHeaderWidth() const override;
void PaintHeader(gfx::Canvas* canvas, Mode mode) override;
void LayoutHeader() override;
......@@ -101,7 +101,7 @@ class BrowserHeaderPainterAsh : public ash::HeaderPainter,
std::unique_ptr<gfx::SlideAnimation> activation_animation_;
DISALLOW_COPY_AND_ASSIGN(BrowserHeaderPainterAsh);
DISALLOW_COPY_AND_ASSIGN(BrowserFrameHeaderAsh);
};
#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_HEADER_PAINTER_ASH_H_
#endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_FRAME_HEADER_ASH_H_
......@@ -10,9 +10,9 @@
#include "ash/ash_layout_constants.h"
#include "ash/frame/caption_buttons/frame_back_button.h"
#include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
#include "ash/frame/default_header_painter.h"
#include "ash/frame/default_frame_header.h"
#include "ash/frame/frame_border_hit_test.h"
#include "ash/frame/header_painter_util.h"
#include "ash/frame/frame_header_util.h"
#include "ash/public/cpp/app_types.h"
#include "ash/public/cpp/ash_switches.h"
#include "ash/shell.h"
......@@ -25,7 +25,7 @@
#include "chrome/browser/ui/extensions/hosted_app_browser_controller.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/views/frame/browser_frame.h"
#include "chrome/browser/ui/views/frame/browser_header_painter_ash.h"
#include "chrome/browser/ui/views/frame/browser_frame_header_ash.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/hosted_app_button_container.h"
#include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
......@@ -109,12 +109,11 @@ void BrowserNonClientFrameViewAsh::Init() {
}
if (UsePackagedAppHeaderStyle()) {
ash::DefaultHeaderPainter* header_painter = new ash::DefaultHeaderPainter;
header_painter_.reset(header_painter);
header_painter->Init(frame(), this, caption_button_container_,
back_button_);
ash::DefaultFrameHeader* frame_header = new ash::DefaultFrameHeader;
frame_header_.reset(frame_header);
frame_header->Init(frame(), this, caption_button_container_, back_button_);
if (window_icon_)
header_painter->UpdateLeftHeaderView(window_icon_);
frame_header->UpdateLeftHeaderView(window_icon_);
extensions::HostedAppBrowserController* app_controller =
browser->hosted_app_controller();
......@@ -124,11 +123,11 @@ void BrowserNonClientFrameViewAsh::Init() {
if (theme_color) {
SkColor opaque_theme_color =
SkColorSetA(theme_color.value(), SK_AlphaOPAQUE);
header_painter->SetFrameColors(opaque_theme_color, opaque_theme_color);
frame_header->SetFrameColors(opaque_theme_color, opaque_theme_color);
}
if (extensions::HostedAppBrowserController::
IsForExperimentalHostedAppBrowser(browser)) {
SkColor text_color = header_painter->GetTitleColor();
SkColor text_color = frame_header->GetTitleColor();
hosted_app_button_container_ = new HostedAppButtonContainer(
browser_view(), text_color,
SkColorSetA(text_color,
......@@ -138,13 +137,13 @@ void BrowserNonClientFrameViewAsh::Init() {
}
} else if (!browser->is_app()) {
// For non app (i.e. WebUI) windows (e.g. Settings) use MD frame color.
header_painter->SetFrameColors(kMdWebUIFrameColor, kMdWebUIFrameColor);
frame_header->SetFrameColors(kMdWebUIFrameColor, kMdWebUIFrameColor);
}
} else {
BrowserHeaderPainterAsh* header_painter = new BrowserHeaderPainterAsh;
header_painter_.reset(header_painter);
header_painter->Init(frame(), browser_view(), this, window_icon_,
caption_button_container_, back_button_);
BrowserFrameHeaderAsh* frame_header = new BrowserFrameHeaderAsh;
frame_header_.reset(frame_header);
frame_header->Init(frame(), browser_view(), this, window_icon_,
caption_button_container_, back_button_);
}
if (browser->is_app()) {
......@@ -196,19 +195,20 @@ int BrowserNonClientFrameViewAsh::GetTopInset(bool restored) const {
if (!browser_view()->IsTabStripVisible()) {
return (UsePackagedAppHeaderStyle())
? header_painter_->GetHeaderHeight()
: caption_button_container_->bounds().bottom();
? frame_header_->GetHeaderHeight()
: caption_button_container_->bounds().bottom();
}
const int header_height = restored
? GetAshLayoutSize(
AshLayoutSize::BROWSER_RESTORED_CAPTION_BUTTON).height()
: header_painter_->GetHeaderHeight();
const int header_height =
restored
? GetAshLayoutSize(AshLayoutSize::BROWSER_RESTORED_CAPTION_BUTTON)
.height()
: frame_header_->GetHeaderHeight();
return header_height - browser_view()->GetTabStripHeight();
}
int BrowserNonClientFrameViewAsh::GetThemeBackgroundXInset() const {
return ash::HeaderPainterUtil::GetThemeBackgroundXInset();
return ash::FrameHeaderUtil::GetThemeBackgroundXInset();
}
void BrowserNonClientFrameViewAsh::UpdateThrobber(bool running) {
......@@ -288,7 +288,7 @@ void BrowserNonClientFrameViewAsh::UpdateWindowIcon() {
void BrowserNonClientFrameViewAsh::UpdateWindowTitle() {
if (!frame()->IsFullscreen())
header_painter_->SchedulePaintForTitle();
frame_header_->SchedulePaintForTitle();
}
void BrowserNonClientFrameViewAsh::SizeConstraintsChanged() {
......@@ -302,11 +302,12 @@ void BrowserNonClientFrameViewAsh::OnPaint(gfx::Canvas* canvas) {
return;
const bool should_paint_as_active = ShouldPaintAsActive();
header_painter_->SetPaintAsActive(should_paint_as_active);
frame_header_->SetPaintAsActive(should_paint_as_active);
const ash::HeaderPainter::Mode header_mode = should_paint_as_active ?
ash::HeaderPainter::MODE_ACTIVE : ash::HeaderPainter::MODE_INACTIVE;
header_painter_->PaintHeader(canvas, header_mode);
const ash::FrameHeader::Mode header_mode =
should_paint_as_active ? ash::FrameHeader::MODE_ACTIVE
: ash::FrameHeader::MODE_INACTIVE;
frame_header_->PaintHeader(canvas, header_mode);
if (hosted_app_button_container_)
hosted_app_button_container_->SetPaintAsActive(should_paint_as_active);
......@@ -322,13 +323,13 @@ void BrowserNonClientFrameViewAsh::Layout() {
// The header must be laid out before computing |painted_height| because the
// computation of |painted_height| for app and popup windows depends on the
// position of the window controls.
header_painter_->LayoutHeader();
frame_header_->LayoutHeader();
int painted_height = GetTopInset(false);
if (browser_view()->IsTabStripVisible())
painted_height += browser_view()->tabstrip()->GetPreferredSize().height();
header_painter_->SetHeaderHeightForPainting(painted_height);
frame_header_->SetHeaderHeightForPainting(painted_height);
if (profile_indicator_icon())
LayoutProfileIndicatorIcon();
......@@ -353,7 +354,7 @@ void BrowserNonClientFrameViewAsh::GetAccessibleNodeData(
gfx::Size BrowserNonClientFrameViewAsh::GetMinimumSize() const {
gfx::Size min_client_view_size(frame()->client_view()->GetMinimumSize());
int min_width = std::max(header_painter_->GetMinimumHeaderWidth(),
int min_width = std::max(frame_header_->GetMinimumHeaderWidth(),
min_client_view_size.width());
if (browser_view()->IsTabStripVisible()) {
// Ensure that the minimum width is enough to hold a minimum width tab strip
......
......@@ -20,7 +20,7 @@ class TabIconView;
namespace ash {
class FrameCaptionButton;
class FrameCaptionButtonContainerView;
class HeaderPainter;
class FrameHeader;
}
// Provides the BrowserNonClientFrameView for Chrome OS.
......@@ -91,7 +91,7 @@ class BrowserNonClientFrameViewAsh : public BrowserNonClientFrameView,
FRIEND_TEST_ALL_PREFIXES(ImmersiveModeControllerAshHostedAppBrowserTest,
FrameLayout);
friend class BrowserHeaderPainterAsh;
friend class BrowserFrameHeaderAsh;
// Distance between the left edge of the NonClientFrameView and the tab strip.
int GetTabStripLeftInset() const;
......@@ -124,7 +124,7 @@ class BrowserNonClientFrameViewAsh : public BrowserNonClientFrameView,
TabIconView* window_icon_;
// Helper class for painting the header.
std::unique_ptr<ash::HeaderPainter> header_painter_;
std::unique_ptr<ash::FrameHeader> frame_header_;
// Container for extra frame buttons shown for hosted app windows.
// Owned by views hierarchy.
......
......@@ -7,8 +7,8 @@
#include "ash/ash_constants.h"
#include "ash/frame/caption_buttons/frame_caption_button.h"
#include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
#include "ash/frame/default_header_painter.h"
#include "ash/frame/header_painter.h"
#include "ash/frame/default_frame_header.h"
#include "ash/frame/frame_header.h"
#include "ash/public/cpp/ash_switches.h"
#include "ash/public/cpp/immersive/immersive_fullscreen_controller_test_api.h"
#include "ash/shell.h"
......@@ -186,7 +186,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNonClientFrameViewAshTest, ImmersiveFullscreen) {
// Frame paints by default.
EXPECT_TRUE(frame_view->ShouldPaint());
EXPECT_LT(0, frame_view->header_painter_->GetHeaderHeightForPainting());
EXPECT_LT(0, frame_view->frame_header_->GetHeaderHeightForPainting());
// Enter both browser fullscreen and tab fullscreen. Entering browser
// fullscreen should enable immersive fullscreen.
......@@ -207,7 +207,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNonClientFrameViewAshTest, ImmersiveFullscreen) {
revealed_lock.reset();
EXPECT_FALSE(immersive_mode_controller->IsRevealed());
EXPECT_FALSE(frame_view->ShouldPaint());
EXPECT_EQ(0, frame_view->header_painter_->GetHeaderHeightForPainting());
EXPECT_EQ(0, frame_view->frame_header_->GetHeaderHeightForPainting());
// Repeat test but without tab fullscreen.
ExitFullscreenModeForTabAndWait(browser(), web_contents);
......@@ -218,13 +218,13 @@ IN_PROC_BROWSER_TEST_F(BrowserNonClientFrameViewAshTest, ImmersiveFullscreen) {
EXPECT_TRUE(immersive_mode_controller->IsRevealed());
EXPECT_TRUE(frame_view->ShouldPaint());
EXPECT_TRUE(frame_view->caption_button_container_->visible());
EXPECT_LT(0, frame_view->header_painter_->GetHeaderHeightForPainting());
EXPECT_LT(0, frame_view->frame_header_->GetHeaderHeightForPainting());
// Ending the reveal. Immersive browser should have the same behavior as full
// screen, i.e., having an origin of (0,0).
revealed_lock.reset();
EXPECT_FALSE(frame_view->ShouldPaint());
EXPECT_EQ(0, frame_view->header_painter_->GetHeaderHeightForPainting());
EXPECT_EQ(0, frame_view->frame_header_->GetHeaderHeightForPainting());
// Exiting immersive fullscreen should make the caption buttons and the frame
// visible again.
......@@ -232,7 +232,7 @@ IN_PROC_BROWSER_TEST_F(BrowserNonClientFrameViewAshTest, ImmersiveFullscreen) {
EXPECT_FALSE(immersive_mode_controller->IsEnabled());
EXPECT_TRUE(frame_view->ShouldPaint());
EXPECT_TRUE(frame_view->caption_button_container_->visible());
EXPECT_LT(0, frame_view->header_painter_->GetHeaderHeightForPainting());
EXPECT_LT(0, frame_view->frame_header_->GetHeaderHeightForPainting());
}
// Tests that Avatar icon should show on the top left corner of the teleported
......@@ -483,10 +483,10 @@ IN_PROC_BROWSER_TEST_F(HostedAppNonClientFrameViewAshTest, HostedAppFrame) {
EXPECT_TRUE(frame_view->hosted_app_button_container_->visible());
// Ensure the theme color is set.
auto* header_painter = static_cast<ash::DefaultHeaderPainter*>(
frame_view->header_painter_.get());
EXPECT_EQ(SK_ColorBLUE, header_painter->GetActiveFrameColor());
EXPECT_EQ(SK_ColorBLUE, header_painter->GetInactiveFrameColor());
auto* frame_header =
static_cast<ash::DefaultFrameHeader*>(frame_view->frame_header_.get());
EXPECT_EQ(SK_ColorBLUE, frame_header->GetActiveFrameColor());
EXPECT_EQ(SK_ColorBLUE, frame_header->GetInactiveFrameColor());
// Show the menu.
HostedAppButtonContainer::AppMenuButton* menu_button =
......
......@@ -11,8 +11,8 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/views/frame/browser_frame.h"
#include "chrome/browser/ui/views/frame/browser_frame_header_ash.h"
#include "chrome/browser/ui/views/frame/browser_frame_mus.h"
#include "chrome/browser/ui/views/frame/browser_header_painter_ash.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
#include "chrome/browser/ui/views/frame/top_container_view.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment