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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 } | 194 } |
| 195 | 195 |
| 196 location_icon_view_ = new LocationIconView(this); | 196 location_icon_view_ = new LocationIconView(this); |
| 197 location_icon_view_->set_drag_controller(this); | 197 location_icon_view_->set_drag_controller(this); |
| 198 AddChildView(location_icon_view_); | 198 AddChildView(location_icon_view_); |
| 199 | 199 |
| 200 // Determine the main font. | 200 // Determine the main font. |
| 201 gfx::FontList font_list = ResourceBundle::GetSharedInstance().GetFontList( | 201 gfx::FontList font_list = ResourceBundle::GetSharedInstance().GetFontList( |
| 202 ResourceBundle::BaseFont); | 202 ResourceBundle::BaseFont); |
| 203 const int current_font_size = font_list.GetFontSize(); | 203 const int current_font_size = font_list.GetFontSize(); |
| 204 const int desired_font_size = browser_defaults::kOmniboxFontPixelSize; | 204 const int desired_font_size = GetThemeProvider()->GetDisplayProperty( |
|
Peter Kasting
2015/08/21 17:14:35
Please remove the declaration and definition of th
tdanderson
2015/08/21 18:17:24
Done.
| |
| 205 ThemeProperties::PROPERTY_OMNIBOX_FONT_PIXEL_SIZE); | |
| 205 if (current_font_size != desired_font_size) { | 206 if (current_font_size != desired_font_size) { |
| 206 font_list = | 207 font_list = |
| 207 font_list.DeriveWithSizeDelta(desired_font_size - current_font_size); | 208 font_list.DeriveWithSizeDelta(desired_font_size - current_font_size); |
| 208 } | 209 } |
| 209 // Shrink large fonts to make them fit. | 210 // Shrink large fonts to make them fit. |
| 210 // TODO(pkasting): Stretch the location bar instead in this case. | 211 // TODO(pkasting): Stretch the location bar instead in this case. |
| 211 const int location_height = GetInternalHeight(true); | 212 const int location_height = ui::MaterialDesignController::IsModeMaterial() ? |
| 213 GetThemeProvider()->GetDisplayProperty( | |
| 214 ThemeProperties::PROPERTY_LOCATION_BAR_HEIGHT) : | |
| 215 GetInternalHeight(true); | |
| 212 font_list = font_list.DeriveWithHeightUpperBound(location_height); | 216 font_list = font_list.DeriveWithHeightUpperBound(location_height); |
| 213 | 217 |
| 214 // Determine the font for use inside the bubbles. The bubble background | 218 // Determine the font for use inside the bubbles. The bubble background |
| 215 // images have 1 px thick edges, which we don't want to overlap. | 219 // images have 1 px thick edges, which we don't want to overlap. |
| 216 const int kBubbleInteriorVerticalPadding = 1; | 220 const int kBubbleInteriorVerticalPadding = 1; |
| 217 const int bubble_padding = GetThemeProvider()->GetDisplayProperty( | 221 const int bubble_padding = GetThemeProvider()->GetDisplayProperty( |
| 218 ThemeProperties::PROPERTY_LOCATION_BAR_BUBBLE_VERTICAL_PADDING); | 222 ThemeProperties::PROPERTY_LOCATION_BAR_BUBBLE_VERTICAL_PADDING); |
| 219 const int bubble_vertical_padding = | 223 const int bubble_vertical_padding = |
| 220 (bubble_padding + kBubbleInteriorVerticalPadding) * 2; | 224 (bubble_padding + kBubbleInteriorVerticalPadding) * 2; |
| 221 const gfx::FontList bubble_font_list(font_list.DeriveWithHeightUpperBound( | 225 const gfx::FontList bubble_font_list(font_list.DeriveWithHeightUpperBound( |
| 222 location_height - bubble_vertical_padding)); | 226 location_height - bubble_vertical_padding)); |
|
jonross
2015/08/21 14:44:13
Do we intend to have the bubble font also refer to
| |
| 223 | 227 |
| 224 const SkColor background_color = | 228 const SkColor background_color = |
| 225 GetColor(connection_security::NONE, LocationBarView::BACKGROUND); | 229 GetColor(connection_security::NONE, LocationBarView::BACKGROUND); |
| 226 ev_bubble_view_ = new EVBubbleView( | 230 ev_bubble_view_ = new EVBubbleView( |
| 227 bubble_font_list, GetColor(connection_security::EV_SECURE, SECURITY_TEXT), | 231 bubble_font_list, GetColor(connection_security::EV_SECURE, SECURITY_TEXT), |
| 228 background_color, this); | 232 background_color, this); |
| 229 ev_bubble_view_->set_drag_controller(this); | 233 ev_bubble_view_->set_drag_controller(this); |
| 230 AddChildView(ev_bubble_view_); | 234 AddChildView(ev_bubble_view_); |
| 231 | 235 |
| 232 // Initialize the Omnibox view. | 236 // Initialize the Omnibox view. |
| (...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1409 | 1413 |
| 1410 void LocationBarView::ModelChanged(const SearchModel::State& old_state, | 1414 void LocationBarView::ModelChanged(const SearchModel::State& old_state, |
| 1411 const SearchModel::State& new_state) { | 1415 const SearchModel::State& new_state) { |
| 1412 const bool visible = !GetToolbarModel()->input_in_progress() && | 1416 const bool visible = !GetToolbarModel()->input_in_progress() && |
| 1413 new_state.voice_search_supported; | 1417 new_state.voice_search_supported; |
| 1414 if (mic_search_view_->visible() != visible) { | 1418 if (mic_search_view_->visible() != visible) { |
| 1415 mic_search_view_->SetVisible(visible); | 1419 mic_search_view_->SetVisible(visible); |
| 1416 Layout(); | 1420 Layout(); |
| 1417 } | 1421 } |
| 1418 } | 1422 } |
| OLD | NEW |