Chromium Code Reviews| 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/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 ThemeProperties::GetDefaultColor(ThemeProperties::COLOR_TOOLBAR, | 172 ThemeProperties::GetDefaultColor(ThemeProperties::COLOR_TOOLBAR, |
| 173 incognito), | 173 incognito), |
| 174 SkColorGetA(kBorderColor)); | 174 SkColorGetA(kBorderColor)); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void LocationBarView::Init() { | 177 void LocationBarView::Init() { |
| 178 // We need to be in a Widget, otherwise GetNativeTheme() may change and we're | 178 // We need to be in a Widget, otherwise GetNativeTheme() may change and we're |
| 179 // not prepared for that. | 179 // not prepared for that. |
| 180 DCHECK(GetWidget()); | 180 DCHECK(GetWidget()); |
| 181 | 181 |
| 182 if (!ui::MaterialDesignController::IsModeMaterial()) { | 182 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 183 // Make sure children with layers are clipped. | |
| 184 SetPaintToLayer(true); | |
|
bruthig
2016/02/24 17:02:58
Calling SetPaintToLayer(true) causes the View to c
Evan Stade
2016/02/24 23:14:17
done. (Only two spots use this technique AFAIK ---
| |
| 185 SetFillsBoundsOpaquely(false); | |
| 186 layer()->SetMasksToBounds(true); | |
| 187 } else { | |
|
Peter Kasting
2016/02/24 01:46:08
Nit: Can combine this else with subsequent if and
Evan Stade
2016/02/24 23:14:18
Done.
| |
| 183 if (is_popup_mode_) { | 188 if (is_popup_mode_) { |
| 184 const int kOmniboxPopupBorderImages[] = | 189 const int kOmniboxPopupBorderImages[] = |
| 185 IMAGE_GRID(IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW); | 190 IMAGE_GRID(IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW); |
| 186 border_painter_.reset( | 191 border_painter_.reset( |
| 187 views::Painter::CreateImageGridPainter(kOmniboxPopupBorderImages)); | 192 views::Painter::CreateImageGridPainter(kOmniboxPopupBorderImages)); |
| 188 } else { | 193 } else { |
| 189 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 194 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 190 const gfx::Insets omnibox_border_insets(14, 9, 14, 9); | 195 const gfx::Insets omnibox_border_insets(14, 9, 14, 9); |
| 191 border_painter_.reset(views::Painter::CreateImagePainter( | 196 border_painter_.reset(views::Painter::CreateImagePainter( |
| 192 *rb.GetImageSkiaNamed(IDR_OMNIBOX_BORDER), omnibox_border_insets)); | 197 *rb.GetImageSkiaNamed(IDR_OMNIBOX_BORDER), omnibox_border_insets)); |
| (...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1394 // LocationBarView, private TemplateURLServiceObserver implementation: | 1399 // LocationBarView, private TemplateURLServiceObserver implementation: |
| 1395 | 1400 |
| 1396 void LocationBarView::OnTemplateURLServiceChanged() { | 1401 void LocationBarView::OnTemplateURLServiceChanged() { |
| 1397 template_url_service_->RemoveObserver(this); | 1402 template_url_service_->RemoveObserver(this); |
| 1398 template_url_service_ = nullptr; | 1403 template_url_service_ = nullptr; |
| 1399 // If the browser is no longer active, let's not show the info bubble, as this | 1404 // If the browser is no longer active, let's not show the info bubble, as this |
| 1400 // would make the browser the active window again. | 1405 // would make the browser the active window again. |
| 1401 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1406 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
| 1402 ShowFirstRunBubble(); | 1407 ShowFirstRunBubble(); |
| 1403 } | 1408 } |
| OLD | NEW |