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

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

Issue 1740883002: Increase location bar bubble font padding in material hybrid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/layout_constants.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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } else if (is_popup_mode_) { 187 } else if (is_popup_mode_) {
188 const int kOmniboxPopupBorderImages[] = 188 const int kOmniboxPopupBorderImages[] =
189 IMAGE_GRID(IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW); 189 IMAGE_GRID(IDR_OMNIBOX_POPUP_BORDER_AND_SHADOW);
190 border_painter_.reset( 190 border_painter_.reset(
191 views::Painter::CreateImageGridPainter(kOmniboxPopupBorderImages)); 191 views::Painter::CreateImageGridPainter(kOmniboxPopupBorderImages));
192 } else { 192 } else {
193 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 193 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
194 const gfx::Insets omnibox_border_insets(14, 9, 14, 9); 194 const gfx::Insets omnibox_border_insets(14, 9, 14, 9);
195 border_painter_.reset(views::Painter::CreateImagePainter( 195 border_painter_.reset(views::Painter::CreateImagePainter(
196 *rb.GetImageSkiaNamed(IDR_OMNIBOX_BORDER), omnibox_border_insets)); 196 *rb.GetImageSkiaNamed(IDR_OMNIBOX_BORDER), omnibox_border_insets));
197 } 197 }
198 198
199 // Determine the main font. 199 // Determine the main font.
200 gfx::FontList font_list = ResourceBundle::GetSharedInstance().GetFontList( 200 gfx::FontList font_list = ResourceBundle::GetSharedInstance().GetFontList(
201 ResourceBundle::BaseFont); 201 ResourceBundle::BaseFont);
202 const int current_font_size = font_list.GetFontSize(); 202 const int current_font_size = font_list.GetFontSize();
203 const int desired_font_size = GetLayoutConstant(OMNIBOX_FONT_PIXEL_SIZE); 203 const int desired_font_size = GetLayoutConstant(OMNIBOX_FONT_PIXEL_SIZE);
204 if (current_font_size != desired_font_size) { 204 if (current_font_size != desired_font_size) {
205 font_list = 205 font_list =
206 font_list.DeriveWithSizeDelta(desired_font_size - current_font_size); 206 font_list.DeriveWithSizeDelta(desired_font_size - current_font_size);
207 } 207 }
208 // Shrink large fonts to make them fit. 208 // Shrink large fonts to make them fit.
209 // TODO(pkasting): Stretch the location bar instead in this case. 209 // TODO(pkasting): Stretch the location bar instead in this case.
210 const int vertical_padding = GetVerticalEdgeThicknessWithPadding(); 210 const int vertical_padding = GetVerticalEdgeThicknessWithPadding();
211 const int location_height = 211 const int location_height =
212 std::max(GetPreferredSize().height() - (vertical_padding * 2), 0); 212 std::max(GetPreferredSize().height() - (vertical_padding * 2), 0);
213 font_list = font_list.DeriveWithHeightUpperBound(location_height); 213 font_list = font_list.DeriveWithHeightUpperBound(location_height);
214 214
215 // Determine the font for use inside the bubbles. 215 // Determine the font for use inside the bubbles.
216 const int kBubbleFontVerticalPadding =
217 ui::MaterialDesignController::IsModeMaterial() ? 2 : 1;
218 const int bubble_padding = 216 const int bubble_padding =
219 GetLayoutConstant(LOCATION_BAR_BUBBLE_VERTICAL_PADDING) + 217 GetLayoutConstant(LOCATION_BAR_BUBBLE_VERTICAL_PADDING) +
220 kBubbleFontVerticalPadding; 218 GetLayoutConstant(LOCATION_BAR_BUBBLE_FONT_VERTICAL_PADDING);
221 const int bubble_height = location_height - (bubble_padding * 2); 219 const int bubble_height = location_height - (bubble_padding * 2);
222 gfx::FontList bubble_font_list = 220 gfx::FontList bubble_font_list =
223 font_list.DeriveWithHeightUpperBound(bubble_height); 221 font_list.DeriveWithHeightUpperBound(bubble_height);
224 222
225 const SkColor background_color = GetColor(BACKGROUND); 223 const SkColor background_color = GetColor(BACKGROUND);
226 location_icon_view_ = 224 location_icon_view_ =
227 new LocationIconView(bubble_font_list, background_color, this); 225 new LocationIconView(bubble_font_list, background_color, this);
228 location_icon_view_->set_drag_controller(this); 226 location_icon_view_->set_drag_controller(this);
229 AddChildView(location_icon_view_); 227 AddChildView(location_icon_view_);
230 228
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 // LocationBarView, private TemplateURLServiceObserver implementation: 1388 // LocationBarView, private TemplateURLServiceObserver implementation:
1391 1389
1392 void LocationBarView::OnTemplateURLServiceChanged() { 1390 void LocationBarView::OnTemplateURLServiceChanged() {
1393 template_url_service_->RemoveObserver(this); 1391 template_url_service_->RemoveObserver(this);
1394 template_url_service_ = nullptr; 1392 template_url_service_ = nullptr;
1395 // If the browser is no longer active, let's not show the info bubble, as this 1393 // If the browser is no longer active, let's not show the info bubble, as this
1396 // would make the browser the active window again. 1394 // would make the browser the active window again.
1397 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) 1395 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive())
1398 ShowFirstRunBubble(); 1396 ShowFirstRunBubble();
1399 } 1397 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/layout_constants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698