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/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 DCHECK(GetWidget()); | 239 DCHECK(GetWidget()); |
240 | 240 |
241 location_icon_view_ = new LocationIconView(this); | 241 location_icon_view_ = new LocationIconView(this); |
242 location_icon_view_->set_drag_controller(this); | 242 location_icon_view_->set_drag_controller(this); |
243 AddChildView(location_icon_view_); | 243 AddChildView(location_icon_view_); |
244 | 244 |
245 // Determine the main font. | 245 // Determine the main font. |
246 gfx::Font font(ui::ResourceBundle::GetSharedInstance().GetFont( | 246 gfx::Font font(ui::ResourceBundle::GetSharedInstance().GetFont( |
247 ui::ResourceBundle::BaseFont)); | 247 ui::ResourceBundle::BaseFont)); |
248 const int current_font_size = font.GetFontSize(); | 248 const int current_font_size = font.GetFontSize(); |
249 const int kAutocompleteEditFontPixelSize = 15; | 249 const int desired_font_size = browser_defaults::kOmniboxFontPixelSize; |
250 const int kAutocompleteEditFontPixelSizeInPopup = 12; | |
251 const int desired_font_size = is_popup_mode_ ? | |
252 kAutocompleteEditFontPixelSizeInPopup : kAutocompleteEditFontPixelSize; | |
253 if (current_font_size < desired_font_size) | 250 if (current_font_size < desired_font_size) |
254 font = font.DeriveFont(desired_font_size - current_font_size); | 251 font = font.DeriveFont(desired_font_size - current_font_size); |
255 // Shrink large fonts to make them fit. | 252 // Shrink large fonts to make them fit. |
256 // TODO(pkasting): Stretch the location bar instead in this case. | 253 // TODO(pkasting): Stretch the location bar instead in this case. |
257 int location_height = GetInternalHeight(true); | 254 int location_height = GetInternalHeight(true); |
258 int font_y_offset; | 255 int font_y_offset; |
259 CalculateFontAndOffsetForHeight(location_height, &font, &font_y_offset); | 256 CalculateFontAndOffsetForHeight(location_height, &font, &font_y_offset); |
260 | 257 |
261 // Determine the font for use inside the bubbles. | 258 // Determine the font for use inside the bubbles. |
262 gfx::Font bubble_font(font); | 259 gfx::Font bubble_font(font); |
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1543 int LocationBarView::GetInternalHeight(bool use_preferred_size) { | 1540 int LocationBarView::GetInternalHeight(bool use_preferred_size) { |
1544 int total_height = | 1541 int total_height = |
1545 use_preferred_size ? GetPreferredSize().height() : height(); | 1542 use_preferred_size ? GetPreferredSize().height() : height(); |
1546 return std::max(total_height - (vertical_edge_thickness() * 2), 0); | 1543 return std::max(total_height - (vertical_edge_thickness() * 2), 0); |
1547 } | 1544 } |
1548 | 1545 |
1549 bool LocationBarView::HasValidSuggestText() const { | 1546 bool LocationBarView::HasValidSuggestText() const { |
1550 return suggested_text_view_->visible() && | 1547 return suggested_text_view_->visible() && |
1551 !suggested_text_view_->size().IsEmpty(); | 1548 !suggested_text_view_->size().IsEmpty(); |
1552 } | 1549 } |
OLD | NEW |