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

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

Issue 1724333002: [MD] Don't allow overflowing location icons to appear on top of toolbar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: streamline conditionals, add comments Created 4 years, 10 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/dropdown_bar_host.cc ('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 (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
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 if (is_popup_mode_) { 183 // Make sure children with layers are clipped. See http://crbug.com/589497
184 const int kOmniboxPopupBorderImages[] = 184 SetPaintToLayer(true);
185 IMAGE_GRID(IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW); 185 SetFillsBoundsOpaquely(false);
186 border_painter_.reset( 186 layer()->SetMasksToBounds(true);
187 views::Painter::CreateImageGridPainter(kOmniboxPopupBorderImages)); 187 } else if (is_popup_mode_) {
188 } else { 188 const int kOmniboxPopupBorderImages[] =
189 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 189 IMAGE_GRID(IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW);
190 const gfx::Insets omnibox_border_insets(14, 9, 14, 9); 190 border_painter_.reset(
191 border_painter_.reset(views::Painter::CreateImagePainter( 191 views::Painter::CreateImageGridPainter(kOmniboxPopupBorderImages));
192 *rb.GetImageSkiaNamed(IDR_OMNIBOX_BORDER), omnibox_border_insets)); 192 } else {
193 } 193 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
194 } 194 const gfx::Insets omnibox_border_insets(14, 9, 14, 9);
195 border_painter_.reset(views::Painter::CreateImagePainter(
196 *rb.GetImageSkiaNamed(IDR_OMNIBOX_BORDER), omnibox_border_insets));
197 }
195 198
196 // Determine the main font. 199 // Determine the main font.
197 gfx::FontList font_list = ResourceBundle::GetSharedInstance().GetFontList( 200 gfx::FontList font_list = ResourceBundle::GetSharedInstance().GetFontList(
198 ResourceBundle::BaseFont); 201 ResourceBundle::BaseFont);
199 const int current_font_size = font_list.GetFontSize(); 202 const int current_font_size = font_list.GetFontSize();
200 const int desired_font_size = GetLayoutConstant(OMNIBOX_FONT_PIXEL_SIZE); 203 const int desired_font_size = GetLayoutConstant(OMNIBOX_FONT_PIXEL_SIZE);
201 if (current_font_size != desired_font_size) { 204 if (current_font_size != desired_font_size) {
202 font_list = 205 font_list =
203 font_list.DeriveWithSizeDelta(desired_font_size - current_font_size); 206 font_list.DeriveWithSizeDelta(desired_font_size - current_font_size);
204 } 207 }
(...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 // LocationBarView, private TemplateURLServiceObserver implementation: 1397 // LocationBarView, private TemplateURLServiceObserver implementation:
1395 1398
1396 void LocationBarView::OnTemplateURLServiceChanged() { 1399 void LocationBarView::OnTemplateURLServiceChanged() {
1397 template_url_service_->RemoveObserver(this); 1400 template_url_service_->RemoveObserver(this);
1398 template_url_service_ = nullptr; 1401 template_url_service_ = nullptr;
1399 // If the browser is no longer active, let's not show the info bubble, as this 1402 // 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. 1403 // would make the browser the active window again.
1401 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) 1404 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive())
1402 ShowFirstRunBubble(); 1405 ShowFirstRunBubble();
1403 } 1406 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/dropdown_bar_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698