Chromium Code Reviews| Index: chrome/browser/ui/views/location_bar/location_bar_view.cc |
| diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc |
| index 6fa564c80ed6cf52220c34dac82c0389ce3cc1ed..ebea0371631c0ddfa055686e9edc9a7763c48a37 100644 |
| --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc |
| +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc |
| @@ -105,12 +105,12 @@ using views::View; |
| namespace { |
| -// The border color for MD windows, as well as non-MD popup windows. |
| -const SkColor kBorderColor = SkColorSetA(SK_ColorBLACK, 0x4D); |
| +// The border color and opacity. |
| +const SkColor kBorderColor = SK_ColorBLACK; |
| +const SkAlpha kBorderOpacity = 0x4D; |
| } // namespace |
| - |
| // LocationBarView ----------------------------------------------------------- |
| // static |
| @@ -162,12 +162,11 @@ LocationBarView::~LocationBarView() { |
| // LocationBarView, public: |
| // static |
| -SkColor LocationBarView::GetBorderColor(bool incognito) { |
| - return color_utils::AlphaBlend( |
| - SkColorSetA(kBorderColor, SK_AlphaOPAQUE), |
| - ThemeProperties::GetDefaultColor(ThemeProperties::COLOR_TOOLBAR, |
| - incognito), |
| - SkColorGetA(kBorderColor)); |
| +SkColor LocationBarView::GetOpaqueBorderColor(bool incognito) { |
| + return color_utils::AlphaBlend(kBorderColor, |
| + ThemeProperties::GetDefaultColor( |
| + ThemeProperties::COLOR_TOOLBAR, incognito), |
| + kBorderOpacity); |
|
Peter Kasting
2017/02/02 00:51:35
Even simpler: Leave kBorderColor as partly-transpa
Evan Stade
2017/02/02 22:39:42
Done.
|
| } |
| void LocationBarView::Init() { |
| @@ -640,11 +639,16 @@ void LocationBarView::Layout() { |
| void LocationBarView::OnNativeThemeChanged(const ui::NativeTheme* theme) { |
| RefreshLocationIcon(); |
| - if (!is_popup_mode_) { |
| + if (is_popup_mode_) { |
| set_background( |
| - new BackgroundWith1PxBorder(GetColor(BACKGROUND), kBorderColor)); |
| - SchedulePaint(); |
| + views::Background::CreateSolidBackground(GetColor(BACKGROUND))); |
| + } else { |
| + // This border color will be blended on top of the toolbar (which may use an |
| + // image in the case of themes). |
| + set_background(new BackgroundWith1PxBorder( |
| + GetColor(BACKGROUND), SkColorSetA(kBorderColor, kBorderOpacity))); |
| } |
| + SchedulePaint(); |
| } |
| void LocationBarView::Update(const WebContents* contents) { |
| @@ -1148,20 +1152,15 @@ void LocationBarView::OnPaint(gfx::Canvas* canvas) { |
| canvas->DrawRoundRect(focus_rect, |
| BackgroundWith1PxBorder::kCornerRadius + 0.5f, paint); |
| } |
| +} |
| + |
| +void LocationBarView::OnPaintBorder(gfx::Canvas* canvas) { |
| if (!is_popup_mode_) |
| - return; // The background and border are painted by our Background. |
| + return; // The border is painted by our Background. |
| - // Fill the location bar background color behind the border. Parts of the |
| - // border images are meant to rest atop the toolbar background and parts atop |
| - // the omnibox background, so we can't just blindly fill our entire bounds. |
| gfx::Rect bounds(GetContentsBounds()); |
| - bounds.Inset(GetHorizontalEdgeThickness(), |
|
Evan Stade
2017/02/01 23:58:33
since is_popup_mode_ is true, this was returning 0
|
| - is_popup_mode_ |
|
Evan Stade
2017/02/01 23:58:33
always true
|
| - ? 0 |
| - : BackgroundWith1PxBorder::kLocationBarBorderThicknessDip); |
| - SkColor background_color(GetColor(BACKGROUND)); |
| - canvas->FillRect(bounds, background_color); |
| - const SkColor border_color = GetBorderColor(profile()->IsOffTheRecord()); |
| + const SkColor border_color = |
| + GetOpaqueBorderColor(profile()->IsOffTheRecord()); |
| BrowserView::Paint1pxHorizontalLine(canvas, border_color, bounds, false); |
| BrowserView::Paint1pxHorizontalLine(canvas, border_color, bounds, true); |
| } |