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

Side by Side Diff: chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc

Issue 1438513003: [MD] Implement incognito colors as a NativeTheme (for Aura). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: init param, pkasting feedback 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/location_bar/icon_label_bubble_view.h" 5 #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/ui/views/layout_constants.h" 8 #include "chrome/browser/ui/views/layout_constants.h"
9 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h" 9 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h"
10 #include "ui/base/resource/material_design/material_design_controller.h" 10 #include "ui/base/resource/material_design/material_design_controller.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 width() - pre_label_width - GetBubbleOuterPadding(false), 114 width() - pre_label_width - GetBubbleOuterPadding(false),
115 height()); 115 height());
116 } 116 }
117 117
118 void IconLabelBubbleView::OnNativeThemeChanged( 118 void IconLabelBubbleView::OnNativeThemeChanged(
119 const ui::NativeTheme* native_theme) { 119 const ui::NativeTheme* native_theme) {
120 if (!ui::MaterialDesignController::IsModeMaterial()) 120 if (!ui::MaterialDesignController::IsModeMaterial())
121 return; 121 return;
122 122
123 label_->SetEnabledColor(GetTextColor()); 123 label_->SetEnabledColor(GetTextColor());
124 SkColor border_color = GetBorderColor(); 124
125 SkColor background_color = SkColorSetA(border_color, 0x13); 125 bool inverted =
126 color_utils::GetLuminanceForColor(parent_background_color_) < 128;
127 SkColor border_color = inverted ? SK_ColorWHITE : GetBorderColor();
128 SkColor background_color =
129 inverted ? SK_ColorWHITE : SkColorSetA(border_color, 0x13);
126 set_background( 130 set_background(
127 new BackgroundWith1PxBorder(background_color, border_color, false)); 131 new BackgroundWith1PxBorder(background_color, border_color, false));
128 SetLabelBackgroundColor(background_color); 132 SetLabelBackgroundColor(background_color);
129 } 133 }
130 134
131 gfx::Size IconLabelBubbleView::GetSizeForLabelWidth(int width) const { 135 gfx::Size IconLabelBubbleView::GetSizeForLabelWidth(int width) const {
132 gfx::Size size(image_->GetPreferredSize()); 136 gfx::Size size(image_->GetPreferredSize());
133 if (ShouldShowBackground()) { 137 if (ShouldShowBackground()) {
134 const int non_label_width = GetBubbleOuterPadding(true) + 138 const int non_label_width = GetBubbleOuterPadding(true) +
135 GetImageAndPaddingWidth() + 139 GetImageAndPaddingWidth() +
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 183 }
180 184
181 void IconLabelBubbleView::OnPaint(gfx::Canvas* canvas) { 185 void IconLabelBubbleView::OnPaint(gfx::Canvas* canvas) {
182 if (!ShouldShowBackground()) 186 if (!ShouldShowBackground())
183 return; 187 return;
184 if (background_painter_) 188 if (background_painter_)
185 background_painter_->Paint(canvas, size()); 189 background_painter_->Paint(canvas, size());
186 if (background()) 190 if (background())
187 background()->Paint(canvas, this); 191 background()->Paint(canvas, this);
188 } 192 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_frame.cc ('k') | chrome/browser/ui/views/location_bar/location_bar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698