summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkasting <pkasting@chromium.org>2016-02-12 17:12:39 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-13 01:13:30 +0000
commite04472a7bd8979950b10e82adcc738071ebe8fa3 (patch)
tree7bed61a2fd94ad8afc81af585615db36e87033e5
parentb59bdf93386bdbc454f721df6046a75bb2c10f40 (diff)
downloadchromium_src-e04472a7bd8979950b10e82adcc738071ebe8fa3.zip
chromium_src-e04472a7bd8979950b10e82adcc738071ebe8fa3.tar.gz
chromium_src-e04472a7bd8979950b10e82adcc738071ebe8fa3.tar.bz2
Remove machinery to dynamically update left view X inset.
This wasn't being used anyway. https://codereview.chromium.org/1285353002/ removed the only meaningful call to it, and while https://codereview.chromium.org/1317053007/ added back that call, it failed to add back the "else" that would make that call do anything. I intended to restore this "else", then wondered what had been broken as a result. It turns out the only case that would have been affected is a window with both the OTR image and a window icon -- which never happens to my knowledge. So just rip out all this stuff. BUG=none TEST=none Review URL: https://codereview.chromium.org/1691103004 Cr-Commit-Position: refs/heads/master@{#375307}
-rw-r--r--ash/frame/default_header_painter.cc32
-rw-r--r--ash/frame/default_header_painter.h5
-rw-r--r--ash/frame/header_painter.h3
-rw-r--r--ash/frame/header_painter_util.cc6
-rw-r--r--ash/frame/header_painter_util.h2
-rw-r--r--chrome/browser/ui/views/frame/browser_header_painter_ash.cc7
-rw-r--r--chrome/browser/ui/views/frame/browser_header_painter_ash.h2
-rw-r--r--chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc6
-rw-r--r--mash/wm/frame/default_header_painter.cc32
-rw-r--r--mash/wm/frame/default_header_painter.h5
-rw-r--r--mash/wm/frame/header_painter.h3
-rw-r--r--mash/wm/frame/header_painter_util.cc6
-rw-r--r--mash/wm/frame/header_painter_util.h2
13 files changed, 30 insertions, 81 deletions
diff --git a/ash/frame/default_header_painter.cc b/ash/frame/default_header_painter.cc
index ed39751..432764b 100644
--- a/ash/frame/default_header_painter.cc
+++ b/ash/frame/default_header_painter.cc
@@ -81,7 +81,6 @@ DefaultHeaderPainter::DefaultHeaderPainter()
: frame_(NULL),
view_(NULL),
left_header_view_(NULL),
- left_view_x_inset_(HeaderPainterUtil::GetDefaultLeftViewXInset()),
active_frame_color_(kDefaultFrameColor),
inactive_frame_color_(kDefaultFrameColor),
caption_button_container_(NULL),
@@ -171,7 +170,16 @@ void DefaultHeaderPainter::LayoutHeader() {
caption_button_container_size.width(),
caption_button_container_size.height());
- LayoutLeftHeaderView();
+ if (left_header_view_) {
+ // Vertically center the left header view with respect to the caption button
+ // container.
+ // Floor when computing the center of |caption_button_container_|.
+ gfx::Size size = left_header_view_->GetPreferredSize();
+ int icon_offset_y =
+ caption_button_container_->height() / 2 - size.height() / 2;
+ left_header_view_->SetBounds(HeaderPainterUtil::GetLeftViewXInset(),
+ icon_offset_y, size.width(), size.height());
+ }
// The header/content separator line overlays the caption buttons.
SetHeaderHeightForPainting(caption_button_container_->height());
@@ -193,13 +201,6 @@ void DefaultHeaderPainter::SchedulePaintForTitle() {
view_->SchedulePaintInRect(GetTitleBounds());
}
-void DefaultHeaderPainter::UpdateLeftViewXInset(int left_view_x_inset) {
- if (left_view_x_inset_ != left_view_x_inset) {
- left_view_x_inset_ = left_view_x_inset;
- LayoutLeftHeaderView();
- }
-}
-
void DefaultHeaderPainter::SetFrameColors(SkColor active_frame_color,
SkColor inactive_frame_color) {
active_frame_color_ = active_frame_color;
@@ -277,19 +278,6 @@ void DefaultHeaderPainter::PaintHeaderContentSeparator(gfx::Canvas* canvas) {
canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint);
}
-void DefaultHeaderPainter::LayoutLeftHeaderView() {
- if (left_header_view_) {
- // Vertically center the left header view with respect to the caption button
- // container.
- // Floor when computing the center of |caption_button_container_|.
- gfx::Size size = left_header_view_->GetPreferredSize();
- int icon_offset_y = caption_button_container_->height() / 2 -
- size.height() / 2;
- left_header_view_->SetBounds(
- left_view_x_inset_, icon_offset_y, size.width(), size.height());
- }
-}
-
bool DefaultHeaderPainter::ShouldUseLightImages() {
int luminance = color_utils::GetLuminanceForColor(
mode_ == MODE_INACTIVE ? inactive_frame_color_ : active_frame_color_);
diff --git a/ash/frame/default_header_painter.h b/ash/frame/default_header_painter.h
index d56c265..e4fb9b3 100644
--- a/ash/frame/default_header_painter.h
+++ b/ash/frame/default_header_painter.h
@@ -47,7 +47,6 @@ class ASH_EXPORT DefaultHeaderPainter : public HeaderPainter,
int GetHeaderHeightForPainting() const override;
void SetHeaderHeightForPainting(int height) override;
void SchedulePaintForTitle() override;
- void UpdateLeftViewXInset(int left_view_x_inset) override;
// Sets the left header view for the header. Passing NULL removes the view.
void UpdateLeftHeaderView(views::View* left_header_view);
@@ -73,9 +72,6 @@ class ASH_EXPORT DefaultHeaderPainter : public HeaderPainter,
// Paints the header/content separator.
void PaintHeaderContentSeparator(gfx::Canvas* canvas);
- // Layout the left header view.
- void LayoutLeftHeaderView();
-
// Whether light caption images should be used. This is the case when the
// background of the frame is dark.
bool ShouldUseLightImages();
@@ -100,7 +96,6 @@ class ASH_EXPORT DefaultHeaderPainter : public HeaderPainter,
views::Widget* frame_;
views::View* view_;
views::View* left_header_view_; // May be NULL.
- int left_view_x_inset_;
SkColor active_frame_color_;
SkColor inactive_frame_color_;
FrameCaptionButtonContainerView* caption_button_container_;
diff --git a/ash/frame/header_painter.h b/ash/frame/header_painter.h
index 47ba306..cfefa2e 100644
--- a/ash/frame/header_painter.h
+++ b/ash/frame/header_painter.h
@@ -44,9 +44,6 @@ class ASH_EXPORT HeaderPainter {
// Schedule a re-paint of the entire title.
virtual void SchedulePaintForTitle() = 0;
-
- // Updates the x inset of the leftmost view in the header.
- virtual void UpdateLeftViewXInset(int left_view_x_inset) = 0;
};
} // namespace ash
diff --git a/ash/frame/header_painter_util.cc b/ash/frame/header_painter_util.cc
index 3e7dee5..ab5b9d5 100644
--- a/ash/frame/header_painter_util.cc
+++ b/ash/frame/header_painter_util.cc
@@ -20,7 +20,7 @@ namespace {
const int kTopCornerRadiusWhenRestored = 2;
// Distance between left edge of the window and the leftmost view.
-const int kDefaultLeftViewXInset = 9;
+const int kLeftViewXInset = 9;
// Space between the title text and the caption buttons.
const int kTitleCaptionButtonSpacing = 5;
@@ -49,8 +49,8 @@ int HeaderPainterUtil::GetTopCornerRadiusWhenRestored() {
}
// static
-int HeaderPainterUtil::GetDefaultLeftViewXInset() {
- return kDefaultLeftViewXInset;
+int HeaderPainterUtil::GetLeftViewXInset() {
+ return kLeftViewXInset;
}
// static
diff --git a/ash/frame/header_painter_util.h b/ash/frame/header_painter_util.h
index de14990..d0b5e3c 100644
--- a/ash/frame/header_painter_util.h
+++ b/ash/frame/header_painter_util.h
@@ -28,7 +28,7 @@ class ASH_EXPORT HeaderPainterUtil {
// Returns the default distance between the left edge of the window and the
// leftmost view in the header.
- static int GetDefaultLeftViewXInset();
+ static int GetLeftViewXInset();
// Returns the amount that the frame background is inset from the left edge of
// the window.
diff --git a/chrome/browser/ui/views/frame/browser_header_painter_ash.cc b/chrome/browser/ui/views/frame/browser_header_painter_ash.cc
index bf27474..14c8bc3 100644
--- a/chrome/browser/ui/views/frame/browser_header_painter_ash.cc
+++ b/chrome/browser/ui/views/frame/browser_header_painter_ash.cc
@@ -122,7 +122,6 @@ BrowserHeaderPainterAsh::BrowserHeaderPainterAsh()
is_incognito_(false),
view_(nullptr),
window_icon_(nullptr),
- window_icon_x_inset_(ash::HeaderPainterUtil::GetDefaultLeftViewXInset()),
caption_button_container_(nullptr),
painted_height_(0),
initial_paint_(true),
@@ -260,7 +259,7 @@ void BrowserHeaderPainterAsh::LayoutHeader() {
gfx::Size icon_size(window_icon_->GetPreferredSize());
int icon_offset_y = (caption_button_container_->height() -
icon_size.height()) / 2;
- window_icon_->SetBounds(window_icon_x_inset_,
+ window_icon_->SetBounds(ash::HeaderPainterUtil::GetLeftViewXInset(),
icon_offset_y,
icon_size.width(),
icon_size.height());
@@ -283,10 +282,6 @@ void BrowserHeaderPainterAsh::SchedulePaintForTitle() {
view_->SchedulePaintInRect(GetTitleBounds());
}
-void BrowserHeaderPainterAsh::UpdateLeftViewXInset(int left_view_x_inset) {
- window_icon_x_inset_ = left_view_x_inset;
-}
-
///////////////////////////////////////////////////////////////////////////////
// gfx::AnimationDelegate overrides:
diff --git a/chrome/browser/ui/views/frame/browser_header_painter_ash.h b/chrome/browser/ui/views/frame/browser_header_painter_ash.h
index e5dc84f..04ed84c 100644
--- a/chrome/browser/ui/views/frame/browser_header_painter_ash.h
+++ b/chrome/browser/ui/views/frame/browser_header_painter_ash.h
@@ -51,7 +51,6 @@ class BrowserHeaderPainterAsh : public ash::HeaderPainter,
int GetHeaderHeightForPainting() const override;
void SetHeaderHeightForPainting(int height) override;
void SchedulePaintForTitle() override;
- void UpdateLeftViewXInset(int left_view_x_inset) override;
private:
// gfx::AnimationDelegate override:
@@ -99,7 +98,6 @@ class BrowserHeaderPainterAsh : public ash::HeaderPainter,
views::View* view_;
views::View* window_icon_;
- int window_icon_x_inset_;
ash::FrameCaptionButtonContainerView* caption_button_container_;
int painted_height_;
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
index 7ba0133..4899bb0 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
@@ -328,12 +328,8 @@ void BrowserNonClientFrameViewAsh::Layout() {
header_painter_->SetHeaderHeightForPainting(painted_height);
- if (avatar_button()) {
+ if (avatar_button())
LayoutAvatar();
- header_painter_->UpdateLeftViewXInset(avatar_button()->bounds().right());
- }
- header_painter_->UpdateLeftViewXInset(
- ash::HeaderPainterUtil::GetDefaultLeftViewXInset());
BrowserNonClientFrameView::Layout();
}
diff --git a/mash/wm/frame/default_header_painter.cc b/mash/wm/frame/default_header_painter.cc
index 755ad7f..ed2a66d 100644
--- a/mash/wm/frame/default_header_painter.cc
+++ b/mash/wm/frame/default_header_painter.cc
@@ -83,7 +83,6 @@ DefaultHeaderPainter::DefaultHeaderPainter()
: frame_(NULL),
view_(NULL),
left_header_view_(NULL),
- left_view_x_inset_(HeaderPainterUtil::GetDefaultLeftViewXInset()),
active_frame_color_(kDefaultFrameColor),
inactive_frame_color_(kDefaultFrameColor),
caption_button_container_(NULL),
@@ -169,7 +168,16 @@ void DefaultHeaderPainter::LayoutHeader() {
caption_button_container_size.width(),
caption_button_container_size.height());
- LayoutLeftHeaderView();
+ if (left_header_view_) {
+ // Vertically center the left header view with respect to the caption button
+ // container.
+ // Floor when computing the center of |caption_button_container_|.
+ gfx::Size size = left_header_view_->GetPreferredSize();
+ int icon_offset_y =
+ caption_button_container_->height() / 2 - size.height() / 2;
+ left_header_view_->SetBounds(HeaderPainterUtil::GetLeftViewXInset(),
+ icon_offset_y, size.width(), size.height());
+ }
// The header/content separator line overlays the caption buttons.
SetHeaderHeightForPainting(caption_button_container_->height());
@@ -191,13 +199,6 @@ void DefaultHeaderPainter::SchedulePaintForTitle() {
view_->SchedulePaintInRect(GetTitleBounds());
}
-void DefaultHeaderPainter::UpdateLeftViewXInset(int left_view_x_inset) {
- if (left_view_x_inset_ != left_view_x_inset) {
- left_view_x_inset_ = left_view_x_inset;
- LayoutLeftHeaderView();
- }
-}
-
void DefaultHeaderPainter::SetFrameColors(SkColor active_frame_color,
SkColor inactive_frame_color) {
active_frame_color_ = active_frame_color;
@@ -267,19 +268,6 @@ void DefaultHeaderPainter::PaintHeaderContentSeparator(gfx::Canvas* canvas) {
canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint);
}
-void DefaultHeaderPainter::LayoutLeftHeaderView() {
- if (left_header_view_) {
- // Vertically center the left header view with respect to the caption button
- // container.
- // Floor when computing the center of |caption_button_container_|.
- gfx::Size size = left_header_view_->GetPreferredSize();
- int icon_offset_y =
- caption_button_container_->height() / 2 - size.height() / 2;
- left_header_view_->SetBounds(left_view_x_inset_, icon_offset_y,
- size.width(), size.height());
- }
-}
-
bool DefaultHeaderPainter::ShouldUseLightImages() {
int luminance = color_utils::GetLuminanceForColor(
mode_ == MODE_INACTIVE ? inactive_frame_color_ : active_frame_color_);
diff --git a/mash/wm/frame/default_header_painter.h b/mash/wm/frame/default_header_painter.h
index 9c275e7..c2763e6 100644
--- a/mash/wm/frame/default_header_painter.h
+++ b/mash/wm/frame/default_header_painter.h
@@ -46,7 +46,6 @@ class DefaultHeaderPainter : public HeaderPainter,
int GetHeaderHeightForPainting() const override;
void SetHeaderHeightForPainting(int height) override;
void SchedulePaintForTitle() override;
- void UpdateLeftViewXInset(int left_view_x_inset) override;
// Sets the left header view for the header. Passing NULL removes the view.
void UpdateLeftHeaderView(views::View* left_header_view);
@@ -69,9 +68,6 @@ class DefaultHeaderPainter : public HeaderPainter,
// Paints the header/content separator.
void PaintHeaderContentSeparator(gfx::Canvas* canvas);
- // Layout the left header view.
- void LayoutLeftHeaderView();
-
// Whether light caption images should be used. This is the case when the
// background of the frame is dark.
bool ShouldUseLightImages();
@@ -96,7 +92,6 @@ class DefaultHeaderPainter : public HeaderPainter,
views::Widget* frame_;
views::View* view_;
views::View* left_header_view_; // May be NULL.
- int left_view_x_inset_;
SkColor active_frame_color_;
SkColor inactive_frame_color_;
FrameCaptionButtonContainerView* caption_button_container_;
diff --git a/mash/wm/frame/header_painter.h b/mash/wm/frame/header_painter.h
index 84eef20..4328c19 100644
--- a/mash/wm/frame/header_painter.h
+++ b/mash/wm/frame/header_painter.h
@@ -41,9 +41,6 @@ class HeaderPainter {
// Schedule a re-paint of the entire title.
virtual void SchedulePaintForTitle() = 0;
-
- // Updates the x inset of the leftmost view in the header.
- virtual void UpdateLeftViewXInset(int left_view_x_inset) = 0;
};
} // namespace wm
diff --git a/mash/wm/frame/header_painter_util.cc b/mash/wm/frame/header_painter_util.cc
index a658d16..3c76097 100644
--- a/mash/wm/frame/header_painter_util.cc
+++ b/mash/wm/frame/header_painter_util.cc
@@ -17,7 +17,7 @@ namespace {
const int kTopCornerRadiusWhenRestored = 2;
// Distance between left edge of the window and the leftmost view.
-const int kDefaultLeftViewXInset = 9;
+const int kLeftViewXInset = 9;
// Space between the title text and the caption buttons.
const int kTitleCaptionButtonSpacing = 5;
@@ -47,8 +47,8 @@ int HeaderPainterUtil::GetTopCornerRadiusWhenRestored() {
}
// static
-int HeaderPainterUtil::GetDefaultLeftViewXInset() {
- return kDefaultLeftViewXInset;
+int HeaderPainterUtil::GetLeftViewXInset() {
+ return kLeftViewXInset;
}
// static
diff --git a/mash/wm/frame/header_painter_util.h b/mash/wm/frame/header_painter_util.h
index 230c832..fba2c49 100644
--- a/mash/wm/frame/header_painter_util.h
+++ b/mash/wm/frame/header_painter_util.h
@@ -28,7 +28,7 @@ class HeaderPainterUtil {
// Returns the default distance between the left edge of the window and the
// leftmost view in the header.
- static int GetDefaultLeftViewXInset();
+ static int GetLeftViewXInset();
// Returns the amount that the frame background is inset from the left edge of
// the window.