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

Side by Side Diff: chrome/browser/ui/views/frame/browser_header_painter_ash.cc

Issue 2290703002: Make title text white in ash incognito popup window frames. (Closed)
Patch Set: Created 4 years, 3 months 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
« no previous file with comments | « chrome/browser/ui/views/frame/browser_header_painter_ash.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/grit/ash_resources.h" 10 #include "ash/resources/grit/ash_resources.h"
11 #include "base/logging.h" // DCHECK 11 #include "base/logging.h" // DCHECK
12 #include "chrome/browser/themes/theme_properties.h" 12 #include "chrome/browser/themes/theme_properties.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/views/frame/browser_frame.h" 14 #include "chrome/browser/ui/views/frame/browser_frame.h"
15 #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"
16 #include "chrome/browser/ui/views/frame/browser_view.h" 16 #include "chrome/browser/ui/views/frame/browser_view.h"
17 #include "chrome/grit/theme_resources.h" 17 #include "chrome/grit/theme_resources.h"
18 #include "third_party/skia/include/core/SkCanvas.h" 18 #include "third_party/skia/include/core/SkCanvas.h"
19 #include "third_party/skia/include/core/SkColor.h"
19 #include "third_party/skia/include/core/SkPaint.h" 20 #include "third_party/skia/include/core/SkPaint.h"
20 #include "third_party/skia/include/core/SkPath.h" 21 #include "third_party/skia/include/core/SkPath.h"
21 #include "ui/base/material_design/material_design_controller.h" 22 #include "ui/base/material_design/material_design_controller.h"
22 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
23 #include "ui/base/theme_provider.h" 24 #include "ui/base/theme_provider.h"
24 #include "ui/gfx/animation/slide_animation.h" 25 #include "ui/gfx/animation/slide_animation.h"
25 #include "ui/gfx/canvas.h" 26 #include "ui/gfx/canvas.h"
26 #include "ui/gfx/geometry/rect.h" 27 #include "ui/gfx/geometry/rect.h"
27 #include "ui/gfx/image/image_skia.h" 28 #include "ui/gfx/image/image_skia.h"
28 #include "ui/gfx/skia_util.h" 29 #include "ui/gfx/skia_util.h"
29 #include "ui/gfx/vector_icons_public.h" 30 #include "ui/gfx/vector_icons_public.h"
30 #include "ui/views/view.h" 31 #include "ui/views/view.h"
31 #include "ui/views/widget/widget.h" 32 #include "ui/views/widget/widget.h"
32 #include "ui/views/widget/widget_delegate.h" 33 #include "ui/views/widget/widget_delegate.h"
33 34
34 using views::Widget; 35 using views::Widget;
35 36
36 namespace { 37 namespace {
38
37 // Color for the window title text. 39 // Color for the window title text.
38 const SkColor kWindowTitleTextColor = SkColorSetRGB(40, 40, 40); 40 const SkColor kNormalWindowTitleTextColor = SkColorSetRGB(40, 40, 40);
41 const SkColor kIncognitoWindowTitleTextColor = SK_ColorWHITE;
42
39 // Duration of crossfade animation for activating and deactivating frame. 43 // Duration of crossfade animation for activating and deactivating frame.
40 const int kActivationCrossfadeDurationMs = 200; 44 const int kActivationCrossfadeDurationMs = 200;
41 45
42 // Creates a path with rounded top corners. 46 // Creates a path with rounded top corners.
43 SkPath MakeRoundRectPath(const gfx::Rect& bounds, 47 SkPath MakeRoundRectPath(const gfx::Rect& bounds,
44 int top_left_corner_radius, 48 int top_left_corner_radius,
45 int top_right_corner_radius) { 49 int top_right_corner_radius) {
46 SkRect rect = gfx::RectToSkRect(bounds); 50 SkRect rect = gfx::RectToSkRect(bounds);
47 const SkScalar kTopLeftRadius = SkIntToScalar(top_left_corner_radius); 51 const SkScalar kTopLeftRadius = SkIntToScalar(top_left_corner_radius);
48 const SkScalar kTopRightRadius = SkIntToScalar(top_right_corner_radius); 52 const SkScalar kTopRightRadius = SkIntToScalar(top_right_corner_radius);
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 right_edge.width(), 330 right_edge.width(),
327 painted_height_ - top_right_height); 331 painted_height_ - top_right_height);
328 } 332 }
329 333
330 void BrowserHeaderPainterAsh::PaintTitleBar(gfx::Canvas* canvas) { 334 void BrowserHeaderPainterAsh::PaintTitleBar(gfx::Canvas* canvas) {
331 // The window icon is painted by its own views::View. 335 // The window icon is painted by its own views::View.
332 gfx::Rect title_bounds = GetTitleBounds(); 336 gfx::Rect title_bounds = GetTitleBounds();
333 title_bounds.set_x(view_->GetMirroredXForRect(title_bounds)); 337 title_bounds.set_x(view_->GetMirroredXForRect(title_bounds));
334 canvas->DrawStringRectWithFlags(frame_->widget_delegate()->GetWindowTitle(), 338 canvas->DrawStringRectWithFlags(frame_->widget_delegate()->GetWindowTitle(),
335 BrowserFrame::GetTitleFontList(), 339 BrowserFrame::GetTitleFontList(),
336 kWindowTitleTextColor, 340 is_incognito_ ? kIncognitoWindowTitleTextColor
341 : kNormalWindowTitleTextColor,
337 title_bounds, 342 title_bounds,
338 gfx::Canvas::NO_SUBPIXEL_RENDERING); 343 gfx::Canvas::NO_SUBPIXEL_RENDERING);
339 } 344 }
340 345
341 void BrowserHeaderPainterAsh::UpdateCaptionButtons() { 346 void BrowserHeaderPainterAsh::UpdateCaptionButtons() {
342 caption_button_container_->SetButtonImage( 347 caption_button_container_->SetButtonImage(
343 ash::CAPTION_BUTTON_ICON_MINIMIZE, 348 ash::CAPTION_BUTTON_ICON_MINIMIZE,
344 gfx::VectorIconId::WINDOW_CONTROL_MINIMIZE); 349 gfx::VectorIconId::WINDOW_CONTROL_MINIMIZE);
345 caption_button_container_->SetButtonImage( 350 caption_button_container_->SetButtonImage(
346 ash::CAPTION_BUTTON_ICON_CLOSE, gfx::VectorIconId::WINDOW_CONTROL_CLOSE); 351 ash::CAPTION_BUTTON_ICON_CLOSE, gfx::VectorIconId::WINDOW_CONTROL_CLOSE);
(...skipping 19 matching lines...) Expand all
366 } 371 }
367 372
368 gfx::Rect BrowserHeaderPainterAsh::GetPaintedBounds() const { 373 gfx::Rect BrowserHeaderPainterAsh::GetPaintedBounds() const {
369 return gfx::Rect(view_->width(), painted_height_); 374 return gfx::Rect(view_->width(), painted_height_);
370 } 375 }
371 376
372 gfx::Rect BrowserHeaderPainterAsh::GetTitleBounds() const { 377 gfx::Rect BrowserHeaderPainterAsh::GetTitleBounds() const {
373 return ash::HeaderPainterUtil::GetTitleBounds(window_icon_, 378 return ash::HeaderPainterUtil::GetTitleBounds(window_icon_,
374 caption_button_container_, BrowserFrame::GetTitleFontList()); 379 caption_button_container_, BrowserFrame::GetTitleFontList());
375 } 380 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_header_painter_ash.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698