OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/views/frame/browser_header_painter_ash.h" | 5 #include "chrome/browser/ui/views/frame/browser_header_painter_ash.h" |
6 | 6 |
7 #include "ash/common/ash_layout_constants.h" | 7 #include "ash/common/ash_layout_constants.h" |
8 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" | 8 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" |
9 #include "ash/common/frame/header_painter_util.h" | 9 #include "ash/common/frame/header_painter_util.h" |
10 #include "ash/resources/vector_icons/vector_icons.h" | |
11 #include "base/logging.h" // DCHECK | 10 #include "base/logging.h" // DCHECK |
12 #include "chrome/browser/themes/theme_properties.h" | 11 #include "chrome/browser/themes/theme_properties.h" |
13 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/views/frame/browser_frame.h" | 13 #include "chrome/browser/ui/views/frame/browser_frame.h" |
15 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h" | 14 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h" |
16 #include "chrome/browser/ui/views/frame/browser_view.h" | 15 #include "chrome/browser/ui/views/frame/browser_view.h" |
17 #include "third_party/skia/include/core/SkCanvas.h" | 16 #include "third_party/skia/include/core/SkCanvas.h" |
18 #include "third_party/skia/include/core/SkColor.h" | 17 #include "third_party/skia/include/core/SkColor.h" |
19 #include "third_party/skia/include/core/SkPaint.h" | 18 #include "third_party/skia/include/core/SkPaint.h" |
20 #include "third_party/skia/include/core/SkPath.h" | 19 #include "third_party/skia/include/core/SkPath.h" |
21 #include "ui/gfx/animation/slide_animation.h" | 20 #include "ui/gfx/animation/slide_animation.h" |
22 #include "ui/gfx/canvas.h" | 21 #include "ui/gfx/canvas.h" |
23 #include "ui/gfx/geometry/rect.h" | 22 #include "ui/gfx/geometry/rect.h" |
24 #include "ui/gfx/image/image_skia.h" | 23 #include "ui/gfx/image/image_skia.h" |
25 #include "ui/gfx/skia_util.h" | 24 #include "ui/gfx/skia_util.h" |
| 25 #include "ui/gfx/vector_icons_public.h" |
26 #include "ui/views/view.h" | 26 #include "ui/views/view.h" |
27 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
28 #include "ui/views/widget/widget_delegate.h" | 28 #include "ui/views/widget/widget_delegate.h" |
29 | 29 |
30 using views::Widget; | 30 using views::Widget; |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 // Color for the window title text. | 34 // Color for the window title text. |
35 const SkColor kNormalWindowTitleTextColor = SkColorSetRGB(40, 40, 40); | 35 const SkColor kNormalWindowTitleTextColor = SkColorSetRGB(40, 40, 40); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 title_bounds.set_x(view_->GetMirroredXForRect(title_bounds)); | 278 title_bounds.set_x(view_->GetMirroredXForRect(title_bounds)); |
279 canvas->DrawStringRectWithFlags(frame_->widget_delegate()->GetWindowTitle(), | 279 canvas->DrawStringRectWithFlags(frame_->widget_delegate()->GetWindowTitle(), |
280 BrowserFrame::GetTitleFontList(), | 280 BrowserFrame::GetTitleFontList(), |
281 is_incognito_ ? kIncognitoWindowTitleTextColor | 281 is_incognito_ ? kIncognitoWindowTitleTextColor |
282 : kNormalWindowTitleTextColor, | 282 : kNormalWindowTitleTextColor, |
283 title_bounds, | 283 title_bounds, |
284 gfx::Canvas::NO_SUBPIXEL_RENDERING); | 284 gfx::Canvas::NO_SUBPIXEL_RENDERING); |
285 } | 285 } |
286 | 286 |
287 void BrowserHeaderPainterAsh::UpdateCaptionButtons() { | 287 void BrowserHeaderPainterAsh::UpdateCaptionButtons() { |
288 caption_button_container_->SetButtonImage(ash::CAPTION_BUTTON_ICON_MINIMIZE, | 288 caption_button_container_->SetButtonImage( |
289 ash::kWindowControlMinimizeIcon); | 289 ash::CAPTION_BUTTON_ICON_MINIMIZE, |
290 caption_button_container_->SetButtonImage(ash::CAPTION_BUTTON_ICON_CLOSE, | 290 gfx::VectorIconId::WINDOW_CONTROL_MINIMIZE); |
291 ash::kWindowControlCloseIcon); | 291 caption_button_container_->SetButtonImage( |
| 292 ash::CAPTION_BUTTON_ICON_CLOSE, gfx::VectorIconId::WINDOW_CONTROL_CLOSE); |
292 caption_button_container_->SetButtonImage( | 293 caption_button_container_->SetButtonImage( |
293 ash::CAPTION_BUTTON_ICON_LEFT_SNAPPED, | 294 ash::CAPTION_BUTTON_ICON_LEFT_SNAPPED, |
294 ash::kWindowControlLeftSnappedIcon); | 295 gfx::VectorIconId::WINDOW_CONTROL_LEFT_SNAPPED); |
295 caption_button_container_->SetButtonImage( | 296 caption_button_container_->SetButtonImage( |
296 ash::CAPTION_BUTTON_ICON_RIGHT_SNAPPED, | 297 ash::CAPTION_BUTTON_ICON_RIGHT_SNAPPED, |
297 ash::kWindowControlRightSnappedIcon); | 298 gfx::VectorIconId::WINDOW_CONTROL_RIGHT_SNAPPED); |
298 | 299 |
299 const gfx::VectorIcon* size_icon = &ash::kWindowControlMaximizeIcon; | 300 gfx::VectorIconId size_icon_id = gfx::VectorIconId::WINDOW_CONTROL_MAXIMIZE; |
300 gfx::Size button_size( | 301 gfx::Size button_size( |
301 GetAshLayoutSize(AshLayoutSize::BROWSER_RESTORED_CAPTION_BUTTON)); | 302 GetAshLayoutSize(AshLayoutSize::BROWSER_RESTORED_CAPTION_BUTTON)); |
302 if (frame_->IsMaximized() || frame_->IsFullscreen()) { | 303 if (frame_->IsMaximized() || frame_->IsFullscreen()) { |
303 size_icon = &ash::kWindowControlRestoreIcon; | 304 size_icon_id = gfx::VectorIconId::WINDOW_CONTROL_RESTORE; |
304 button_size = | 305 button_size = |
305 GetAshLayoutSize(AshLayoutSize::BROWSER_MAXIMIZED_CAPTION_BUTTON); | 306 GetAshLayoutSize(AshLayoutSize::BROWSER_MAXIMIZED_CAPTION_BUTTON); |
306 } | 307 } |
307 caption_button_container_->SetButtonImage( | 308 caption_button_container_->SetButtonImage( |
308 ash::CAPTION_BUTTON_ICON_MAXIMIZE_RESTORE, *size_icon); | 309 ash::CAPTION_BUTTON_ICON_MAXIMIZE_RESTORE, |
| 310 size_icon_id); |
309 caption_button_container_->SetButtonSize(button_size); | 311 caption_button_container_->SetButtonSize(button_size); |
310 } | 312 } |
311 | 313 |
312 gfx::Rect BrowserHeaderPainterAsh::GetPaintedBounds() const { | 314 gfx::Rect BrowserHeaderPainterAsh::GetPaintedBounds() const { |
313 return gfx::Rect(view_->width(), painted_height_); | 315 return gfx::Rect(view_->width(), painted_height_); |
314 } | 316 } |
315 | 317 |
316 gfx::Rect BrowserHeaderPainterAsh::GetTitleBounds() const { | 318 gfx::Rect BrowserHeaderPainterAsh::GetTitleBounds() const { |
317 return ash::HeaderPainterUtil::GetTitleBounds(window_icon_, | 319 return ash::HeaderPainterUtil::GetTitleBounds(window_icon_, |
318 caption_button_container_, BrowserFrame::GetTitleFontList()); | 320 caption_button_container_, BrowserFrame::GetTitleFontList()); |
319 } | 321 } |
OLD | NEW |