OLD | NEW |
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 const ui::NativeTheme* native_theme) { | 121 const ui::NativeTheme* native_theme) { |
122 if (!ui::MaterialDesignController::IsModeMaterial()) | 122 if (!ui::MaterialDesignController::IsModeMaterial()) |
123 return; | 123 return; |
124 | 124 |
125 label_->SetEnabledColor(GetTextColor()); | 125 label_->SetEnabledColor(GetTextColor()); |
126 | 126 |
127 bool inverted = color_utils::IsDark(GetParentBackgroundColor()); | 127 bool inverted = color_utils::IsDark(GetParentBackgroundColor()); |
128 SkColor border_color = inverted ? SK_ColorWHITE : GetBorderColor(); | 128 SkColor border_color = inverted ? SK_ColorWHITE : GetBorderColor(); |
129 SkColor background_color = | 129 SkColor background_color = |
130 inverted ? SK_ColorWHITE : SkColorSetA(border_color, 0x13); | 130 inverted ? SK_ColorWHITE : SkColorSetA(border_color, 0x13); |
131 set_background( | 131 set_background(new BackgroundWith1PxBorder(background_color, border_color)); |
132 new BackgroundWith1PxBorder(background_color, border_color, false)); | |
133 SetLabelBackgroundColor(background_color); | 132 SetLabelBackgroundColor(background_color); |
134 } | 133 } |
135 | 134 |
136 SkColor IconLabelBubbleView::GetParentBackgroundColor() const { | 135 SkColor IconLabelBubbleView::GetParentBackgroundColor() const { |
137 return ui::MaterialDesignController::IsModeMaterial() | 136 return ui::MaterialDesignController::IsModeMaterial() |
138 ? GetNativeTheme()->GetSystemColor( | 137 ? GetNativeTheme()->GetSystemColor( |
139 ui::NativeTheme::kColorId_TextfieldDefaultBackground) | 138 ui::NativeTheme::kColorId_TextfieldDefaultBackground) |
140 : parent_background_color_; | 139 : parent_background_color_; |
141 } | 140 } |
142 | 141 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 190 } |
192 | 191 |
193 void IconLabelBubbleView::OnPaint(gfx::Canvas* canvas) { | 192 void IconLabelBubbleView::OnPaint(gfx::Canvas* canvas) { |
194 if (!ShouldShowBackground()) | 193 if (!ShouldShowBackground()) |
195 return; | 194 return; |
196 if (background_painter_) | 195 if (background_painter_) |
197 background_painter_->Paint(canvas, size()); | 196 background_painter_->Paint(canvas, size()); |
198 if (background()) | 197 if (background()) |
199 background()->Paint(canvas, this); | 198 background()->Paint(canvas, this); |
200 } | 199 } |
OLD | NEW |