Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(570)

Side by Side Diff: mash/wm/frame/default_header_painter.cc

Issue 1459653002: Gets mustash frames looking like that of ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update test Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/frame/default_header_painter.h" 5 #include "mash/wm/frame/default_header_painter.h"
6 6
7 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
8 #include "ash/frame/header_painter_util.h"
9 #include "base/debug/leak_annotations.h" 7 #include "base/debug/leak_annotations.h"
10 #include "base/logging.h" // DCHECK 8 #include "base/logging.h"
11 #include "grit/ash_resources.h" 9 #include "grit/mash_wm_resources.h"
10 #include "mash/wm/frame/caption_buttons/frame_caption_button_container_view.h"
11 #include "mash/wm/frame/header_painter_util.h"
12 #include "third_party/skia/include/core/SkPaint.h" 12 #include "third_party/skia/include/core/SkPaint.h"
13 #include "third_party/skia/include/core/SkPath.h" 13 #include "third_party/skia/include/core/SkPath.h"
14 #include "ui/base/resource/resource_bundle.h" 14 #include "ui/base/resource/resource_bundle.h"
15 #include "ui/gfx/animation/slide_animation.h" 15 #include "ui/gfx/animation/slide_animation.h"
16 #include "ui/gfx/canvas.h" 16 #include "ui/gfx/canvas.h"
17 #include "ui/gfx/color_utils.h" 17 #include "ui/gfx/color_utils.h"
18 #include "ui/gfx/font_list.h" 18 #include "ui/gfx/font_list.h"
19 #include "ui/gfx/geometry/rect.h" 19 #include "ui/gfx/geometry/rect.h"
20 #include "ui/gfx/image/image.h" 20 #include "ui/gfx/image/image.h"
21 #include "ui/gfx/scoped_canvas.h" 21 #include "ui/gfx/scoped_canvas.h"
(...skipping 21 matching lines...) Expand all
43 // Luminance below which to use white caption buttons. 43 // Luminance below which to use white caption buttons.
44 const int kMaxLuminanceForLightButtons = 125; 44 const int kMaxLuminanceForLightButtons = 125;
45 45
46 // Tiles an image into an area, rounding the top corners. 46 // Tiles an image into an area, rounding the top corners.
47 void TileRoundRect(gfx::Canvas* canvas, 47 void TileRoundRect(gfx::Canvas* canvas,
48 const SkPaint& paint, 48 const SkPaint& paint,
49 const gfx::Rect& bounds, 49 const gfx::Rect& bounds,
50 int corner_radius) { 50 int corner_radius) {
51 SkRect rect = gfx::RectToSkRect(bounds); 51 SkRect rect = gfx::RectToSkRect(bounds);
52 const SkScalar corner_radius_scalar = SkIntToScalar(corner_radius); 52 const SkScalar corner_radius_scalar = SkIntToScalar(corner_radius);
53 SkScalar radii[8] = { 53 SkScalar radii[8] = {corner_radius_scalar,
54 corner_radius_scalar, corner_radius_scalar, // top-left 54 corner_radius_scalar, // top-left
55 corner_radius_scalar, corner_radius_scalar, // top-right 55 corner_radius_scalar,
56 0, 0, // bottom-right 56 corner_radius_scalar, // top-right
57 0, 0}; // bottom-left 57 0,
58 0, // bottom-right
59 0,
60 0}; // bottom-left
58 SkPath path; 61 SkPath path;
59 path.addRoundRect(rect, radii, SkPath::kCW_Direction); 62 path.addRoundRect(rect, radii, SkPath::kCW_Direction);
60 canvas->DrawPath(path, paint); 63 canvas->DrawPath(path, paint);
61 } 64 }
62 65
63 // Returns the FontList to use for the title. 66 // Returns the FontList to use for the title.
64 const gfx::FontList& GetTitleFontList() { 67 const gfx::FontList& GetTitleFontList() {
65 static const gfx::FontList* title_font_list = 68 static const gfx::FontList* title_font_list =
66 new gfx::FontList(views::NativeWidgetAura::GetWindowTitleFontList()); 69 new gfx::FontList(views::NativeWidgetAura::GetWindowTitleFontList());
67 ANNOTATE_LEAKING_OBJECT_PTR(title_font_list); 70 ANNOTATE_LEAKING_OBJECT_PTR(title_font_list);
68 return *title_font_list; 71 return *title_font_list;
69 } 72 }
70 73
71 } // namespace 74 } // namespace
72 75
73 namespace ash { 76 namespace mash {
77 namespace wm {
74 78
75 /////////////////////////////////////////////////////////////////////////////// 79 ///////////////////////////////////////////////////////////////////////////////
76 // DefaultHeaderPainter, public: 80 // DefaultHeaderPainter, public:
77 81
78 DefaultHeaderPainter::DefaultHeaderPainter() 82 DefaultHeaderPainter::DefaultHeaderPainter()
79 : frame_(NULL), 83 : frame_(NULL),
80 view_(NULL), 84 view_(NULL),
81 left_header_view_(NULL), 85 left_header_view_(NULL),
82 left_view_x_inset_(HeaderPainterUtil::GetDefaultLeftViewXInset()), 86 left_view_x_inset_(HeaderPainterUtil::GetDefaultLeftViewXInset()),
83 active_frame_color_(kDefaultFrameColor), 87 active_frame_color_(kDefaultFrameColor),
84 inactive_frame_color_(kDefaultFrameColor), 88 inactive_frame_color_(kDefaultFrameColor),
85 caption_button_container_(NULL), 89 caption_button_container_(NULL),
86 painted_height_(0), 90 painted_height_(0),
87 mode_(MODE_INACTIVE), 91 mode_(MODE_INACTIVE),
88 initial_paint_(true), 92 initial_paint_(true),
89 activation_animation_(new gfx::SlideAnimation(this)) {} 93 activation_animation_(new gfx::SlideAnimation(this)) {}
90 94
91 DefaultHeaderPainter::~DefaultHeaderPainter() { 95 DefaultHeaderPainter::~DefaultHeaderPainter() {}
92 }
93 96
94 void DefaultHeaderPainter::Init( 97 void DefaultHeaderPainter::Init(
95 views::Widget* frame, 98 views::Widget* frame,
96 views::View* header_view, 99 views::View* header_view,
97 FrameCaptionButtonContainerView* caption_button_container) { 100 FrameCaptionButtonContainerView* caption_button_container) {
98 DCHECK(frame); 101 DCHECK(frame);
99 DCHECK(header_view); 102 DCHECK(header_view);
100 DCHECK(caption_button_container); 103 DCHECK(caption_button_container);
101 frame_ = frame; 104 frame_ = frame;
102 view_ = header_view; 105 view_ = header_view;
103 caption_button_container_ = caption_button_container; 106 caption_button_container_ = caption_button_container;
104 UpdateAllButtonImages(); 107 UpdateAllButtonImages();
105 } 108 }
106 109
107 int DefaultHeaderPainter::GetMinimumHeaderWidth() const { 110 int DefaultHeaderPainter::GetMinimumHeaderWidth() const {
108 // Ensure we have enough space for the window icon and buttons. We allow 111 // Ensure we have enough space for the window icon and buttons. We allow
109 // the title string to collapse to zero width. 112 // the title string to collapse to zero width.
110 return GetTitleBounds().x() + 113 return GetTitleBounds().x() +
111 caption_button_container_->GetMinimumSize().width(); 114 caption_button_container_->GetMinimumSize().width();
112 } 115 }
113 116
114 void DefaultHeaderPainter::PaintHeader(gfx::Canvas* canvas, Mode mode) { 117 void DefaultHeaderPainter::PaintHeader(gfx::Canvas* canvas, Mode mode) {
115 Mode old_mode = mode_; 118 Mode old_mode = mode_;
116 mode_ = mode; 119 mode_ = mode;
117 120
118 if (mode_ != old_mode) { 121 if (mode_ != old_mode) {
119 UpdateAllButtonImages(); 122 UpdateAllButtonImages();
120 if (!initial_paint_ && HeaderPainterUtil::CanAnimateActivation(frame_)) { 123 if (!initial_paint_ && HeaderPainterUtil::CanAnimateActivation(frame_)) {
121 activation_animation_->SetSlideDuration(kActivationCrossfadeDurationMs); 124 activation_animation_->SetSlideDuration(kActivationCrossfadeDurationMs);
122 if (mode_ == MODE_ACTIVE) 125 if (mode_ == MODE_ACTIVE)
123 activation_animation_->Show(); 126 activation_animation_->Show();
124 else 127 else
125 activation_animation_->Hide(); 128 activation_animation_->Hide();
126 } else { 129 } else {
127 if (mode_ == MODE_ACTIVE) 130 if (mode_ == MODE_ACTIVE)
128 activation_animation_->Reset(1); 131 activation_animation_->Reset(1);
129 else 132 else
130 activation_animation_->Reset(0); 133 activation_animation_->Reset(0);
131 } 134 }
132 initial_paint_ = false; 135 initial_paint_ = false;
133 } 136 }
134 137
135 int corner_radius = (frame_->IsMaximized() || frame_->IsFullscreen()) ? 138 int corner_radius = (frame_->IsMaximized() || frame_->IsFullscreen())
136 0 : HeaderPainterUtil::GetTopCornerRadiusWhenRestored(); 139 ? 0
140 : HeaderPainterUtil::GetTopCornerRadiusWhenRestored();
137 141
138 SkPaint paint; 142 SkPaint paint;
139 int active_alpha = activation_animation_->CurrentValueBetween(0, 255); 143 int active_alpha = activation_animation_->CurrentValueBetween(0, 255);
140 paint.setColor(color_utils::AlphaBlend(active_frame_color_, 144 paint.setColor(color_utils::AlphaBlend(active_frame_color_,
141 inactive_frame_color_, active_alpha)); 145 inactive_frame_color_, active_alpha));
142 146
143 TileRoundRect(canvas, paint, GetLocalBounds(), corner_radius); 147 TileRoundRect(canvas, paint, GetLocalBounds(), corner_radius);
144 148
145 if (!frame_->IsMaximized() && !frame_->IsFullscreen() && 149 if (!frame_->IsMaximized() && !frame_->IsFullscreen() &&
146 mode_ == MODE_INACTIVE && !UsesCustomFrameColors()) { 150 mode_ == MODE_INACTIVE && !UsesCustomFrameColors()) {
147 PaintHighlightForInactiveRestoredWindow(canvas); 151 PaintHighlightForInactiveRestoredWindow(canvas);
148 } 152 }
149 if (frame_->widget_delegate() && 153 if (frame_->widget_delegate() &&
150 frame_->widget_delegate()->ShouldShowWindowTitle()) { 154 frame_->widget_delegate()->ShouldShowWindowTitle()) {
151 PaintTitleBar(canvas); 155 PaintTitleBar(canvas);
152 } 156 }
153 if (!UsesCustomFrameColors()) 157 if (!UsesCustomFrameColors())
154 PaintHeaderContentSeparator(canvas); 158 PaintHeaderContentSeparator(canvas);
155 } 159 }
156 160
157 void DefaultHeaderPainter::LayoutHeader() { 161 void DefaultHeaderPainter::LayoutHeader() {
158 UpdateSizeButtonImages(ShouldUseLightImages()); 162 UpdateSizeButtonImages(ShouldUseLightImages());
159 caption_button_container_->Layout(); 163 caption_button_container_->Layout();
160 164
161 gfx::Size caption_button_container_size = 165 gfx::Size caption_button_container_size =
162 caption_button_container_->GetPreferredSize(); 166 caption_button_container_->GetPreferredSize();
163 caption_button_container_->SetBounds( 167 caption_button_container_->SetBounds(
164 view_->width() - caption_button_container_size.width(), 168 view_->width() - caption_button_container_size.width(), 0,
165 0,
166 caption_button_container_size.width(), 169 caption_button_container_size.width(),
167 caption_button_container_size.height()); 170 caption_button_container_size.height());
168 171
169 LayoutLeftHeaderView(); 172 LayoutLeftHeaderView();
170 173
171 // The header/content separator line overlays the caption buttons. 174 // The header/content separator line overlays the caption buttons.
172 SetHeaderHeightForPainting(caption_button_container_->height()); 175 SetHeaderHeightForPainting(caption_button_container_->height());
173 } 176 }
174 177
175 int DefaultHeaderPainter::GetHeaderHeight() const { 178 int DefaultHeaderPainter::GetHeaderHeight() const {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 const gfx::Animation* animation) { 216 const gfx::Animation* animation) {
214 view_->SchedulePaintInRect(GetLocalBounds()); 217 view_->SchedulePaintInRect(GetLocalBounds());
215 } 218 }
216 219
217 /////////////////////////////////////////////////////////////////////////////// 220 ///////////////////////////////////////////////////////////////////////////////
218 // DefaultHeaderPainter, private: 221 // DefaultHeaderPainter, private:
219 222
220 void DefaultHeaderPainter::PaintHighlightForInactiveRestoredWindow( 223 void DefaultHeaderPainter::PaintHighlightForInactiveRestoredWindow(
221 gfx::Canvas* canvas) { 224 gfx::Canvas* canvas) {
222 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 225 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
223 gfx::ImageSkia top_edge = *rb.GetImageSkiaNamed( 226 gfx::ImageSkia top_edge =
224 IDR_AURA_WINDOW_HEADER_SHADE_INACTIVE_TOP); 227 *rb.GetImageSkiaNamed(IDR_MASH_WM_WINDOW_HEADER_SHADE_INACTIVE_TOP);
225 gfx::ImageSkia left_edge = *rb.GetImageSkiaNamed( 228 gfx::ImageSkia left_edge =
226 IDR_AURA_WINDOW_HEADER_SHADE_INACTIVE_LEFT); 229 *rb.GetImageSkiaNamed(IDR_MASH_WM_WINDOW_HEADER_SHADE_INACTIVE_LEFT);
227 gfx::ImageSkia right_edge = *rb.GetImageSkiaNamed( 230 gfx::ImageSkia right_edge =
228 IDR_AURA_WINDOW_HEADER_SHADE_INACTIVE_RIGHT); 231 *rb.GetImageSkiaNamed(IDR_MASH_WM_WINDOW_HEADER_SHADE_INACTIVE_RIGHT);
229 gfx::ImageSkia bottom_edge = *rb.GetImageSkiaNamed( 232 gfx::ImageSkia bottom_edge =
230 IDR_AURA_WINDOW_HEADER_SHADE_INACTIVE_BOTTOM); 233 *rb.GetImageSkiaNamed(IDR_MASH_WM_WINDOW_HEADER_SHADE_INACTIVE_BOTTOM);
231 234
232 int left_edge_width = left_edge.width(); 235 int left_edge_width = left_edge.width();
233 int right_edge_width = right_edge.width(); 236 int right_edge_width = right_edge.width();
234 canvas->DrawImageInt(left_edge, 0, 0); 237 canvas->DrawImageInt(left_edge, 0, 0);
235 canvas->DrawImageInt(right_edge, view_->width() - right_edge_width, 0); 238 canvas->DrawImageInt(right_edge, view_->width() - right_edge_width, 0);
236 canvas->TileImageInt( 239 canvas->TileImageInt(top_edge, left_edge_width, 0,
237 top_edge, 240 view_->width() - left_edge_width - right_edge_width,
238 left_edge_width, 241 top_edge.height());
239 0,
240 view_->width() - left_edge_width - right_edge_width,
241 top_edge.height());
242 242
243 DCHECK_EQ(left_edge.height(), right_edge.height()); 243 DCHECK_EQ(left_edge.height(), right_edge.height());
244 int bottom = left_edge.height(); 244 int bottom = left_edge.height();
245 int bottom_height = bottom_edge.height(); 245 int bottom_height = bottom_edge.height();
246 canvas->TileImageInt( 246 canvas->TileImageInt(bottom_edge, left_edge_width, bottom - bottom_height,
247 bottom_edge, 247 view_->width() - left_edge_width - right_edge_width,
248 left_edge_width, 248 bottom_height);
249 bottom - bottom_height,
250 view_->width() - left_edge_width - right_edge_width,
251 bottom_height);
252 } 249 }
253 250
254 void DefaultHeaderPainter::PaintTitleBar(gfx::Canvas* canvas) { 251 void DefaultHeaderPainter::PaintTitleBar(gfx::Canvas* canvas) {
255 // The window icon is painted by its own views::View. 252 // The window icon is painted by its own views::View.
256 gfx::Rect title_bounds = GetTitleBounds(); 253 gfx::Rect title_bounds = GetTitleBounds();
257 title_bounds.set_x(view_->GetMirroredXForRect(title_bounds)); 254 title_bounds.set_x(view_->GetMirroredXForRect(title_bounds));
258 canvas->DrawStringRectWithFlags(frame_->widget_delegate()->GetWindowTitle(), 255 canvas->DrawStringRectWithFlags(
259 GetTitleFontList(), 256 frame_->widget_delegate()->GetWindowTitle(), GetTitleFontList(),
260 kTitleTextColor, 257 kTitleTextColor, title_bounds, gfx::Canvas::NO_SUBPIXEL_RENDERING);
261 title_bounds,
262 gfx::Canvas::NO_SUBPIXEL_RENDERING);
263 } 258 }
264 259
265 void DefaultHeaderPainter::PaintHeaderContentSeparator(gfx::Canvas* canvas) { 260 void DefaultHeaderPainter::PaintHeaderContentSeparator(gfx::Canvas* canvas) {
266 gfx::ScopedCanvas scoped_canvas(canvas); 261 gfx::ScopedCanvas scoped_canvas(canvas);
267 const float scale = canvas->UndoDeviceScaleFactor(); 262 const float scale = canvas->UndoDeviceScaleFactor();
268 gfx::RectF rect(0, painted_height_ * scale - 1, view_->width() * scale, 1); 263 gfx::RectF rect(0, painted_height_ * scale - 1, view_->width() * scale, 1);
269 SkPaint paint; 264 SkPaint paint;
270 paint.setColor((mode_ == MODE_ACTIVE) ? 265 paint.setColor((mode_ == MODE_ACTIVE) ? kHeaderContentSeparatorColor
271 kHeaderContentSeparatorColor : kHeaderContentSeparatorInactiveColor); 266 : kHeaderContentSeparatorInactiveColor);
272 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint); 267 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint);
273 } 268 }
274 269
275 void DefaultHeaderPainter::LayoutLeftHeaderView() { 270 void DefaultHeaderPainter::LayoutLeftHeaderView() {
276 if (left_header_view_) { 271 if (left_header_view_) {
277 // Vertically center the left header view with respect to the caption button 272 // Vertically center the left header view with respect to the caption button
278 // container. 273 // container.
279 // Floor when computing the center of |caption_button_container_|. 274 // Floor when computing the center of |caption_button_container_|.
280 gfx::Size size = left_header_view_->GetPreferredSize(); 275 gfx::Size size = left_header_view_->GetPreferredSize();
281 int icon_offset_y = caption_button_container_->height() / 2 - 276 int icon_offset_y =
282 size.height() / 2; 277 caption_button_container_->height() / 2 - size.height() / 2;
283 left_header_view_->SetBounds( 278 left_header_view_->SetBounds(left_view_x_inset_, icon_offset_y,
284 left_view_x_inset_, icon_offset_y, size.width(), size.height()); 279 size.width(), size.height());
285 } 280 }
286 } 281 }
287 282
288 bool DefaultHeaderPainter::ShouldUseLightImages() { 283 bool DefaultHeaderPainter::ShouldUseLightImages() {
289 int luminance = color_utils::GetLuminanceForColor( 284 int luminance = color_utils::GetLuminanceForColor(
290 mode_ == MODE_INACTIVE ? inactive_frame_color_ : active_frame_color_); 285 mode_ == MODE_INACTIVE ? inactive_frame_color_ : active_frame_color_);
291 return luminance < kMaxLuminanceForLightButtons; 286 return luminance < kMaxLuminanceForLightButtons;
292 } 287 }
293 288
294 void DefaultHeaderPainter::UpdateAllButtonImages() { 289 void DefaultHeaderPainter::UpdateAllButtonImages() {
295 bool use_light_images = ShouldUseLightImages(); 290 bool use_light_images = ShouldUseLightImages();
296 caption_button_container_->SetButtonImages( 291 caption_button_container_->SetButtonImages(
297 CAPTION_BUTTON_ICON_MINIMIZE, 292 CAPTION_BUTTON_ICON_MINIMIZE,
298 use_light_images ? IDR_AURA_WINDOW_CONTROL_ICON_MINIMIZE_WHITE 293 use_light_images ? IDR_MASH_WM_WINDOW_CONTROL_ICON_MINIMIZE_WHITE
299 : IDR_AURA_WINDOW_CONTROL_ICON_MINIMIZE, 294 : IDR_MASH_WM_WINDOW_CONTROL_ICON_MINIMIZE,
300 IDR_AURA_WINDOW_CONTROL_BACKGROUND_H, 295 IDR_MASH_WM_WINDOW_CONTROL_BACKGROUND_H,
301 IDR_AURA_WINDOW_CONTROL_BACKGROUND_P); 296 IDR_MASH_WM_WINDOW_CONTROL_BACKGROUND_P);
302 297
303 UpdateSizeButtonImages(use_light_images); 298 UpdateSizeButtonImages(use_light_images);
304 299
305 caption_button_container_->SetButtonImages( 300 caption_button_container_->SetButtonImages(
306 CAPTION_BUTTON_ICON_CLOSE, 301 CAPTION_BUTTON_ICON_CLOSE,
307 use_light_images ? IDR_AURA_WINDOW_CONTROL_ICON_CLOSE_WHITE 302 use_light_images ? IDR_MASH_WM_WINDOW_CONTROL_ICON_CLOSE_WHITE
308 : IDR_AURA_WINDOW_CONTROL_ICON_CLOSE, 303 : IDR_MASH_WM_WINDOW_CONTROL_ICON_CLOSE,
309 IDR_AURA_WINDOW_CONTROL_BACKGROUND_H, 304 IDR_MASH_WM_WINDOW_CONTROL_BACKGROUND_H,
310 IDR_AURA_WINDOW_CONTROL_BACKGROUND_P); 305 IDR_MASH_WM_WINDOW_CONTROL_BACKGROUND_P);
311 306
312 caption_button_container_->SetButtonImages( 307 caption_button_container_->SetButtonImages(
313 CAPTION_BUTTON_ICON_LEFT_SNAPPED, 308 CAPTION_BUTTON_ICON_LEFT_SNAPPED,
314 use_light_images ? IDR_AURA_WINDOW_CONTROL_ICON_LEFT_SNAPPED_WHITE 309 use_light_images ? IDR_MASH_WM_WINDOW_CONTROL_ICON_LEFT_SNAPPED_WHITE
315 : IDR_AURA_WINDOW_CONTROL_ICON_LEFT_SNAPPED, 310 : IDR_MASH_WM_WINDOW_CONTROL_ICON_LEFT_SNAPPED,
316 IDR_AURA_WINDOW_CONTROL_BACKGROUND_H, 311 IDR_MASH_WM_WINDOW_CONTROL_BACKGROUND_H,
317 IDR_AURA_WINDOW_CONTROL_BACKGROUND_P); 312 IDR_MASH_WM_WINDOW_CONTROL_BACKGROUND_P);
318 313
319 caption_button_container_->SetButtonImages( 314 caption_button_container_->SetButtonImages(
320 CAPTION_BUTTON_ICON_RIGHT_SNAPPED, 315 CAPTION_BUTTON_ICON_RIGHT_SNAPPED,
321 use_light_images ? IDR_AURA_WINDOW_CONTROL_ICON_RIGHT_SNAPPED_WHITE 316 use_light_images ? IDR_MASH_WM_WINDOW_CONTROL_ICON_RIGHT_SNAPPED_WHITE
322 : IDR_AURA_WINDOW_CONTROL_ICON_RIGHT_SNAPPED, 317 : IDR_MASH_WM_WINDOW_CONTROL_ICON_RIGHT_SNAPPED,
323 IDR_AURA_WINDOW_CONTROL_BACKGROUND_H, 318 IDR_MASH_WM_WINDOW_CONTROL_BACKGROUND_H,
324 IDR_AURA_WINDOW_CONTROL_BACKGROUND_P); 319 IDR_MASH_WM_WINDOW_CONTROL_BACKGROUND_P);
325 } 320 }
326 321
327 void DefaultHeaderPainter::UpdateSizeButtonImages(bool use_light_images) { 322 void DefaultHeaderPainter::UpdateSizeButtonImages(bool use_light_images) {
328 int icon_id = 0; 323 int icon_id = 0;
329 if (frame_->IsMaximized() || frame_->IsFullscreen()) { 324 if (frame_->IsMaximized() || frame_->IsFullscreen()) {
330 icon_id = use_light_images ? IDR_AURA_WINDOW_CONTROL_ICON_RESTORE_WHITE 325 icon_id = use_light_images ? IDR_MASH_WM_WINDOW_CONTROL_ICON_RESTORE_WHITE
331 : IDR_AURA_WINDOW_CONTROL_ICON_RESTORE; 326 : IDR_MASH_WM_WINDOW_CONTROL_ICON_RESTORE;
332 } else { 327 } else {
333 icon_id = use_light_images ? IDR_AURA_WINDOW_CONTROL_ICON_MAXIMIZE_WHITE 328 icon_id = use_light_images ? IDR_MASH_WM_WINDOW_CONTROL_ICON_MAXIMIZE_WHITE
334 : IDR_AURA_WINDOW_CONTROL_ICON_MAXIMIZE; 329 : IDR_MASH_WM_WINDOW_CONTROL_ICON_MAXIMIZE;
335 } 330 }
336 caption_button_container_->SetButtonImages( 331 caption_button_container_->SetButtonImages(
337 CAPTION_BUTTON_ICON_MAXIMIZE_RESTORE, 332 CAPTION_BUTTON_ICON_MAXIMIZE_RESTORE, icon_id,
338 icon_id, 333 IDR_MASH_WM_WINDOW_CONTROL_BACKGROUND_H,
339 IDR_AURA_WINDOW_CONTROL_BACKGROUND_H, 334 IDR_MASH_WM_WINDOW_CONTROL_BACKGROUND_P);
340 IDR_AURA_WINDOW_CONTROL_BACKGROUND_P);
341 } 335 }
342 336
343 gfx::Rect DefaultHeaderPainter::GetLocalBounds() const { 337 gfx::Rect DefaultHeaderPainter::GetLocalBounds() const {
344 return gfx::Rect(view_->width(), painted_height_); 338 return gfx::Rect(view_->width(), painted_height_);
345 } 339 }
346 340
347 gfx::Rect DefaultHeaderPainter::GetTitleBounds() const { 341 gfx::Rect DefaultHeaderPainter::GetTitleBounds() const {
348 return HeaderPainterUtil::GetTitleBounds( 342 return HeaderPainterUtil::GetTitleBounds(
349 left_header_view_, caption_button_container_, GetTitleFontList()); 343 left_header_view_, caption_button_container_, GetTitleFontList());
350 } 344 }
351 345
352 bool DefaultHeaderPainter::UsesCustomFrameColors() const { 346 bool DefaultHeaderPainter::UsesCustomFrameColors() const {
353 return active_frame_color_ != kDefaultFrameColor || 347 return active_frame_color_ != kDefaultFrameColor ||
354 inactive_frame_color_ != kDefaultFrameColor; 348 inactive_frame_color_ != kDefaultFrameColor;
355 } 349 }
356 350
357 } // namespace ash 351 } // namespace wm
352 } // namespace mash
OLDNEW
« no previous file with comments | « mash/wm/frame/default_header_painter.h ('k') | mash/wm/frame/frame_border_hit_test_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698