summaryrefslogtreecommitdiffstats
path: root/mash
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 /mash
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}
Diffstat (limited to 'mash')
-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
5 files changed, 14 insertions, 34 deletions
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.