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" |
10 #include "base/logging.h" // DCHECK | 11 #include "base/logging.h" // DCHECK |
11 #include "chrome/browser/themes/theme_properties.h" | 12 #include "chrome/browser/themes/theme_properties.h" |
12 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/views/frame/browser_frame.h" | 14 #include "chrome/browser/ui/views/frame/browser_frame.h" |
14 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h" | 15 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h" |
15 #include "chrome/browser/ui/views/frame/browser_view.h" | 16 #include "chrome/browser/ui/views/frame/browser_view.h" |
16 #include "third_party/skia/include/core/SkCanvas.h" | 17 #include "third_party/skia/include/core/SkCanvas.h" |
17 #include "third_party/skia/include/core/SkColor.h" | 18 #include "third_party/skia/include/core/SkColor.h" |
18 #include "third_party/skia/include/core/SkPaint.h" | 19 #include "third_party/skia/include/core/SkPaint.h" |
19 #include "third_party/skia/include/core/SkPath.h" | 20 #include "third_party/skia/include/core/SkPath.h" |
20 #include "ui/gfx/animation/slide_animation.h" | 21 #include "ui/gfx/animation/slide_animation.h" |
21 #include "ui/gfx/canvas.h" | 22 #include "ui/gfx/canvas.h" |
22 #include "ui/gfx/geometry/rect.h" | 23 #include "ui/gfx/geometry/rect.h" |
23 #include "ui/gfx/image/image_skia.h" | 24 #include "ui/gfx/image/image_skia.h" |
24 #include "ui/gfx/skia_util.h" | 25 #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( | 288 caption_button_container_->SetButtonImage(ash::CAPTION_BUTTON_ICON_MINIMIZE, |
289 ash::CAPTION_BUTTON_ICON_MINIMIZE, | 289 ash::kWindowControlMinimizeIcon); |
290 gfx::VectorIconId::WINDOW_CONTROL_MINIMIZE); | 290 caption_button_container_->SetButtonImage(ash::CAPTION_BUTTON_ICON_CLOSE, |
291 caption_button_container_->SetButtonImage( | 291 ash::kWindowControlCloseIcon); |
292 ash::CAPTION_BUTTON_ICON_CLOSE, gfx::VectorIconId::WINDOW_CONTROL_CLOSE); | |
293 caption_button_container_->SetButtonImage( | 292 caption_button_container_->SetButtonImage( |
294 ash::CAPTION_BUTTON_ICON_LEFT_SNAPPED, | 293 ash::CAPTION_BUTTON_ICON_LEFT_SNAPPED, |
295 gfx::VectorIconId::WINDOW_CONTROL_LEFT_SNAPPED); | 294 ash::kWindowControlLeftSnappedIcon); |
296 caption_button_container_->SetButtonImage( | 295 caption_button_container_->SetButtonImage( |
297 ash::CAPTION_BUTTON_ICON_RIGHT_SNAPPED, | 296 ash::CAPTION_BUTTON_ICON_RIGHT_SNAPPED, |
298 gfx::VectorIconId::WINDOW_CONTROL_RIGHT_SNAPPED); | 297 ash::kWindowControlRightSnappedIcon); |
299 | 298 |
300 gfx::VectorIconId size_icon_id = gfx::VectorIconId::WINDOW_CONTROL_MAXIMIZE; | 299 const gfx::VectorIcon* size_icon = &ash::kWindowControlMaximizeIcon; |
301 gfx::Size button_size( | 300 gfx::Size button_size( |
302 GetAshLayoutSize(AshLayoutSize::BROWSER_RESTORED_CAPTION_BUTTON)); | 301 GetAshLayoutSize(AshLayoutSize::BROWSER_RESTORED_CAPTION_BUTTON)); |
303 if (frame_->IsMaximized() || frame_->IsFullscreen()) { | 302 if (frame_->IsMaximized() || frame_->IsFullscreen()) { |
304 size_icon_id = gfx::VectorIconId::WINDOW_CONTROL_RESTORE; | 303 size_icon = &ash::kWindowControlRestoreIcon; |
305 button_size = | 304 button_size = |
306 GetAshLayoutSize(AshLayoutSize::BROWSER_MAXIMIZED_CAPTION_BUTTON); | 305 GetAshLayoutSize(AshLayoutSize::BROWSER_MAXIMIZED_CAPTION_BUTTON); |
307 } | 306 } |
308 caption_button_container_->SetButtonImage( | 307 caption_button_container_->SetButtonImage( |
309 ash::CAPTION_BUTTON_ICON_MAXIMIZE_RESTORE, | 308 ash::CAPTION_BUTTON_ICON_MAXIMIZE_RESTORE, *size_icon); |
310 size_icon_id); | |
311 caption_button_container_->SetButtonSize(button_size); | 309 caption_button_container_->SetButtonSize(button_size); |
312 } | 310 } |
313 | 311 |
314 gfx::Rect BrowserHeaderPainterAsh::GetPaintedBounds() const { | 312 gfx::Rect BrowserHeaderPainterAsh::GetPaintedBounds() const { |
315 return gfx::Rect(view_->width(), painted_height_); | 313 return gfx::Rect(view_->width(), painted_height_); |
316 } | 314 } |
317 | 315 |
318 gfx::Rect BrowserHeaderPainterAsh::GetTitleBounds() const { | 316 gfx::Rect BrowserHeaderPainterAsh::GetTitleBounds() const { |
319 return ash::HeaderPainterUtil::GetTitleBounds(window_icon_, | 317 return ash::HeaderPainterUtil::GetTitleBounds(window_icon_, |
320 caption_button_container_, BrowserFrame::GetTitleFontList()); | 318 caption_button_container_, BrowserFrame::GetTitleFontList()); |
321 } | 319 } |
OLD | NEW |