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

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

Issue 11418229: alternate ntp: implement right-aligned search token (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re-impl based on philippe's new layout design Created 7 years, 11 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 | Annotate | Revision Log
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/command_line.h" 10 #include "base/command_line.h"
(...skipping 27 matching lines...) Expand all
38 #include "chrome/browser/ui/views/location_bar/action_box_button_view.h" 38 #include "chrome/browser/ui/views/location_bar/action_box_button_view.h"
39 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" 39 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h"
40 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" 40 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h"
41 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" 41 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h"
42 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h" 42 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h"
43 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" 43 #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
44 #include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h" 44 #include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h"
45 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" 45 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
46 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" 46 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h"
47 #include "chrome/browser/ui/views/location_bar/script_bubble_icon_view.h" 47 #include "chrome/browser/ui/views/location_bar/script_bubble_icon_view.h"
48 #include "chrome/browser/ui/views/location_bar/search_token_view.h"
48 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" 49 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h"
49 #include "chrome/browser/ui/views/location_bar/star_view.h" 50 #include "chrome/browser/ui/views/location_bar/star_view.h"
50 #include "chrome/browser/ui/views/location_bar/web_intents_button_view.h" 51 #include "chrome/browser/ui/views/location_bar/web_intents_button_view.h"
51 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" 52 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h"
52 #include "chrome/browser/ui/views/location_bar/zoom_view.h" 53 #include "chrome/browser/ui/views/location_bar/zoom_view.h"
53 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" 54 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
54 #include "chrome/browser/ui/views/omnibox/omnibox_views.h" 55 #include "chrome/browser/ui/views/omnibox/omnibox_views.h"
55 #include "chrome/browser/ui/zoom/zoom_controller.h" 56 #include "chrome/browser/ui/zoom/zoom_controller.h"
56 #include "chrome/common/chrome_notification_types.h" 57 #include "chrome/common/chrome_notification_types.h"
57 #include "chrome/common/extensions/feature_switch.h" 58 #include "chrome/common/extensions/feature_switch.h"
(...skipping 11 matching lines...) Expand all
69 #include "ui/base/resource/resource_bundle.h" 70 #include "ui/base/resource/resource_bundle.h"
70 #include "ui/base/theme_provider.h" 71 #include "ui/base/theme_provider.h"
71 #include "ui/gfx/canvas.h" 72 #include "ui/gfx/canvas.h"
72 #include "ui/gfx/color_utils.h" 73 #include "ui/gfx/color_utils.h"
73 #include "ui/gfx/image/image.h" 74 #include "ui/gfx/image/image.h"
74 #include "ui/gfx/image/image_skia_operations.h" 75 #include "ui/gfx/image/image_skia_operations.h"
75 #include "ui/gfx/skia_util.h" 76 #include "ui/gfx/skia_util.h"
76 #include "ui/views/border.h" 77 #include "ui/views/border.h"
77 #include "ui/views/button_drag_utils.h" 78 #include "ui/views/button_drag_utils.h"
78 #include "ui/views/controls/label.h" 79 #include "ui/views/controls/label.h"
80 #include "ui/views/layout/layout_constants.h"
79 #include "ui/views/widget/widget.h" 81 #include "ui/views/widget/widget.h"
80 82
81 #if defined(OS_WIN) 83 #if defined(OS_WIN)
82 #include "ui/native_theme/native_theme_win.h" 84 #include "ui/native_theme/native_theme_win.h"
83 #endif 85 #endif
84 86
85 #if defined(OS_WIN) && !defined(USE_AURA) 87 #if defined(OS_WIN) && !defined(USE_AURA)
86 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" 88 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h"
87 #endif 89 #endif
88 90
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 disposition_(CURRENT_TAB), 173 disposition_(CURRENT_TAB),
172 transition_(content::PageTransitionFromInt( 174 transition_(content::PageTransitionFromInt(
173 content::PAGE_TRANSITION_TYPED | 175 content::PAGE_TRANSITION_TYPED |
174 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)), 176 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)),
175 location_icon_view_(NULL), 177 location_icon_view_(NULL),
176 ev_bubble_view_(NULL), 178 ev_bubble_view_(NULL),
177 location_entry_view_(NULL), 179 location_entry_view_(NULL),
178 selected_keyword_view_(NULL), 180 selected_keyword_view_(NULL),
179 suggested_text_view_(NULL), 181 suggested_text_view_(NULL),
180 keyword_hint_view_(NULL), 182 keyword_hint_view_(NULL),
183 search_token_view_(NULL),
181 zoom_view_(NULL), 184 zoom_view_(NULL),
182 open_pdf_in_reader_view_(NULL), 185 open_pdf_in_reader_view_(NULL),
183 script_bubble_icon_view_(NULL), 186 script_bubble_icon_view_(NULL),
184 star_view_(NULL), 187 star_view_(NULL),
185 web_intents_button_view_(NULL), 188 web_intents_button_view_(NULL),
186 action_box_button_view_(NULL), 189 action_box_button_view_(NULL),
187 mode_(mode), 190 mode_(mode),
188 show_focus_rect_(false), 191 show_focus_rect_(false),
189 template_url_service_(NULL), 192 template_url_service_(NULL),
190 animation_offset_(0) { 193 animation_offset_(0) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // Use a larger version of the system font. 227 // Use a larger version of the system font.
225 font_ = rb.GetFont(ui::ResourceBundle::MediumFont); 228 font_ = rb.GetFont(ui::ResourceBundle::MediumFont);
226 } 229 }
227 230
228 // If this makes the font too big, try to make it smaller so it will fit. 231 // If this makes the font too big, try to make it smaller so it will fit.
229 const int height = GetInternalHeight(true); 232 const int height = GetInternalHeight(true);
230 while ((font_.GetHeight() > height) && (font_.GetFontSize() > 1)) 233 while ((font_.GetHeight() > height) && (font_.GetFontSize() > 1))
231 font_ = font_.DeriveFont(-1); 234 font_ = font_.DeriveFont(-1);
232 235
233 location_icon_view_ = new LocationIconView(this); 236 location_icon_view_ = new LocationIconView(this);
234 AddChildView(location_icon_view_);
235 location_icon_view_->SetVisible(true); 237 location_icon_view_->SetVisible(true);
236 location_icon_view_->set_drag_controller(this); 238 location_icon_view_->set_drag_controller(this);
239 AddChildView(location_icon_view_);
237 240
238 ev_bubble_view_ = 241 ev_bubble_view_ =
239 new EVBubbleView(kEVBubbleBackgroundImages, IDR_OMNIBOX_HTTPS_VALID, 242 new EVBubbleView(kEVBubbleBackgroundImages, IDR_OMNIBOX_HTTPS_VALID,
240 GetColor(ToolbarModel::EV_SECURE, SECURITY_TEXT), 243 GetColor(ToolbarModel::EV_SECURE, SECURITY_TEXT),
241 this); 244 this);
242 AddChildView(ev_bubble_view_);
243 ev_bubble_view_->SetVisible(false); 245 ev_bubble_view_->SetVisible(false);
244 ev_bubble_view_->set_drag_controller(this); 246 ev_bubble_view_->set_drag_controller(this);
247 AddChildView(ev_bubble_view_);
245 248
246 // URL edit field. 249 // URL edit field.
247 // View container for URL edit field. 250 // View container for URL edit field.
248 location_entry_.reset(CreateOmniboxView(this, model_, profile_, 251 location_entry_.reset(CreateOmniboxView(this, model_, profile_,
249 command_updater_, mode_ == POPUP, this)); 252 command_updater_, mode_ == POPUP, this));
250 SetLocationEntryFocusable(true); 253 SetLocationEntryFocusable(true);
251 254
252 location_entry_view_ = location_entry_->AddToView(this); 255 location_entry_view_ = location_entry_->AddToView(this);
253 location_entry_view_->set_id(VIEW_ID_AUTOCOMPLETE); 256 location_entry_view_->set_id(VIEW_ID_AUTOCOMPLETE);
254 257
255 selected_keyword_view_ = new SelectedKeywordView( 258 selected_keyword_view_ = new SelectedKeywordView(
256 kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER, 259 kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER,
257 GetColor(ToolbarModel::NONE, TEXT), 260 GetColor(ToolbarModel::NONE, TEXT),
258 profile_); 261 profile_);
262 selected_keyword_view_->SetVisible(false);
263 selected_keyword_view_->SetFont(font_);
259 AddChildView(selected_keyword_view_); 264 AddChildView(selected_keyword_view_);
260 selected_keyword_view_->SetFont(font_);
261 selected_keyword_view_->SetVisible(false);
262 265
263 keyword_hint_view_ = new KeywordHintView(profile_, this); 266 keyword_hint_view_ = new KeywordHintView(profile_, this);
264 AddChildView(keyword_hint_view_);
265 keyword_hint_view_->SetVisible(false); 267 keyword_hint_view_->SetVisible(false);
266 keyword_hint_view_->SetFont(font_); 268 keyword_hint_view_->SetFont(font_);
269 AddChildView(keyword_hint_view_);
270
271 search_token_view_ = new SearchTokenView(this);
272 search_token_view_->SetVisible(false);
273 search_token_view_->SetFont(font_);
274 AddChildView(search_token_view_);
267 275
268 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { 276 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
269 ContentSettingImageView* content_blocked_view = 277 ContentSettingImageView* content_blocked_view =
270 new ContentSettingImageView(static_cast<ContentSettingsType>(i), 278 new ContentSettingImageView(static_cast<ContentSettingsType>(i),
271 kCSBubbleBackgroundImages, this, 279 kCSBubbleBackgroundImages, this,
272 font_, 280 font_,
273 GetColor(ToolbarModel::NONE, TEXT)); 281 GetColor(ToolbarModel::NONE, TEXT));
274 content_setting_views_.push_back(content_blocked_view); 282 content_setting_views_.push_back(content_blocked_view);
283 content_blocked_view->SetVisible(false);
275 AddChildView(content_blocked_view); 284 AddChildView(content_blocked_view);
276 content_blocked_view->SetVisible(false);
277 } 285 }
278 286
279 zoom_view_ = new ZoomView(model_, delegate_); 287 zoom_view_ = new ZoomView(model_, delegate_);
280 zoom_view_->set_id(VIEW_ID_ZOOM_BUTTON); 288 zoom_view_->set_id(VIEW_ID_ZOOM_BUTTON);
281 AddChildView(zoom_view_); 289 AddChildView(zoom_view_);
282 290
283 web_intents_button_view_ = 291 web_intents_button_view_ =
284 new WebIntentsButtonView(this, kWIBubbleBackgroundImages, font_, 292 new WebIntentsButtonView(this, kWIBubbleBackgroundImages, font_,
285 GetColor(ToolbarModel::NONE, TEXT)); 293 GetColor(ToolbarModel::NONE, TEXT));
286 AddChildView(web_intents_button_view_); 294 AddChildView(web_intents_button_view_);
287 295
288 open_pdf_in_reader_view_ = new OpenPDFInReaderView(this); 296 open_pdf_in_reader_view_ = new OpenPDFInReaderView(this);
289 AddChildView(open_pdf_in_reader_view_); 297 AddChildView(open_pdf_in_reader_view_);
290 298
291 script_bubble_icon_view_ = new ScriptBubbleIconView(delegate()); 299 script_bubble_icon_view_ = new ScriptBubbleIconView(delegate());
300 script_bubble_icon_view_->SetVisible(false);
292 AddChildView(script_bubble_icon_view_); 301 AddChildView(script_bubble_icon_view_);
293 script_bubble_icon_view_->SetVisible(false);
294 302
295 if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { 303 if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) {
296 // Note: condition above means that the star icon is hidden in popups and in 304 // Note: condition above means that the star icon is hidden in popups and in
297 // the app launcher. 305 // the app launcher.
298 star_view_ = new StarView(command_updater_); 306 star_view_ = new StarView(command_updater_);
307 star_view_->SetVisible(true);
299 AddChildView(star_view_); 308 AddChildView(star_view_);
300 star_view_->SetVisible(true);
301 } 309 }
302 if (extensions::FeatureSwitch::action_box()->IsEnabled() && 310 if (extensions::FeatureSwitch::action_box()->IsEnabled() &&
303 mode_ == NORMAL && browser_) { 311 mode_ == NORMAL && browser_) {
312 if (star_view_)
313 star_view_->SetVisible(false);
314
304 action_box_button_view_ = new ActionBoxButtonView(browser_, 315 action_box_button_view_ = new ActionBoxButtonView(browser_,
305 gfx::Point(kNormalHorizontalEdgeThickness, kVerticalEdgeThickness)); 316 gfx::Point(kNormalHorizontalEdgeThickness, kVerticalEdgeThickness));
306 AddChildView(action_box_button_view_); 317 AddChildView(action_box_button_view_);
307
308 if (star_view_)
309 star_view_->SetVisible(false);
310 } 318 }
311 319
312 registrar_.Add(this, 320 registrar_.Add(this,
313 chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, 321 chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED,
314 content::Source<Profile>(profile_)); 322 content::Source<Profile>(profile_));
315 323
316 // Initialize the location entry. We do this to avoid a black flash which is 324 // Initialize the location entry. We do this to avoid a black flash which is
317 // visible when the location entry has just been initialized. 325 // visible when the location entry has just been initialized.
318 Update(NULL); 326 Update(NULL);
319 327
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 426
419 bool star_enabled = star_view_ && !model_->GetInputInProgress() && 427 bool star_enabled = star_view_ && !model_->GetInputInProgress() &&
420 edit_bookmarks_enabled_.GetValue(); 428 edit_bookmarks_enabled_.GetValue();
421 429
422 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); 430 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled);
423 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE_FROM_STAR, 431 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE_FROM_STAR,
424 star_enabled); 432 star_enabled);
425 if (star_view_ && !extensions::FeatureSwitch::action_box()->IsEnabled()) 433 if (star_view_ && !extensions::FeatureSwitch::action_box()->IsEnabled())
426 star_view_->SetVisible(star_enabled); 434 star_view_->SetVisible(star_enabled);
427 435
436 string16 search_provider;
437 if (!model_->GetInputInProgress() &&
438 model_->WouldReplaceSearchURLWithSearchTerms()) {
439 const TemplateURL* template_url =
440 TemplateURLServiceFactory::GetForProfile(profile_)->
441 GetDefaultSearchProvider();
442 if (template_url) {
443 search_provider = template_url->short_name();
444 search_token_view_->SetBackgroundColor(GetColor(
445 model_->GetSecurityLevel(), LocationBarView::BACKGROUND));
446 search_token_view_->SetForegroundColor(GetColor(
447 model_->GetSecurityLevel(), LocationBarView::DEEMPHASIZED_TEXT));
448 }
449 }
450 search_token_view_->SetSearchProvider(search_provider);
451
428 // Don't Update in app launcher mode so that the location entry does not show 452 // Don't Update in app launcher mode so that the location entry does not show
429 // a URL or security background. 453 // a URL or security background.
430 if (mode_ != APP_LAUNCHER) 454 if (mode_ != APP_LAUNCHER)
431 location_entry_->Update(tab_for_state_restoring); 455 location_entry_->Update(tab_for_state_restoring);
432 OnChanged(); 456 OnChanged();
433 } 457 }
434 458
435 void LocationBarView::UpdateContentSettingsIcons() { 459 void LocationBarView::UpdateContentSettingsIcons() {
436 RefreshContentSettingViews(); 460 RefreshContentSettingViews();
437 461
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 690
667 LocationBarLayout left_decorations(LocationBarLayout::LEFT_EDGE, 691 LocationBarLayout left_decorations(LocationBarLayout::LEFT_EDGE,
668 kItemEditPadding, kEdgeEditPadding); 692 kItemEditPadding, kEdgeEditPadding);
669 LocationBarLayout right_decorations(LocationBarLayout::RIGHT_EDGE, 693 LocationBarLayout right_decorations(LocationBarLayout::RIGHT_EDGE,
670 kItemEditPadding, kEdgeEditPadding); 694 kItemEditPadding, kEdgeEditPadding);
671 695
672 selected_keyword_view_->SetVisible(false); 696 selected_keyword_view_->SetVisible(false);
673 location_icon_view_->SetVisible(false); 697 location_icon_view_->SetVisible(false);
674 ev_bubble_view_->SetVisible(false); 698 ev_bubble_view_->SetVisible(false);
675 keyword_hint_view_->SetVisible(false); 699 keyword_hint_view_->SetVisible(false);
700 search_token_view_->SetVisible(false);
676 701
677 const string16 keyword(location_entry_->model()->keyword()); 702 const string16 keyword(location_entry_->model()->keyword());
678 const bool is_keyword_hint(location_entry_->model()->is_keyword_hint()); 703 const bool is_keyword_hint(location_entry_->model()->is_keyword_hint());
679 const bool show_selected_keyword = !keyword.empty() && !is_keyword_hint; 704 const bool show_selected_keyword = !keyword.empty() && !is_keyword_hint;
680 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint; 705 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint;
beaudoin 2013/01/07 17:27:53 It probably does not make sense to show the keywor
kuan 2013/01/09 19:52:58 Done.
681 if (show_selected_keyword) { 706 if (show_selected_keyword) {
682 left_decorations.AddDecoration( 707 left_decorations.AddDecoration(
683 kBubbleLocationY, 0, true, 0, kBubbleHorizontalPadding, 708 kBubbleLocationY, 0, true, 0, kBubbleHorizontalPadding,
684 GetItemPadding(), 0, selected_keyword_view_); 709 GetItemPadding(), 0, selected_keyword_view_);
685 if (selected_keyword_view_->keyword() != keyword) { 710 if (selected_keyword_view_->keyword() != keyword) {
686 selected_keyword_view_->SetKeyword(keyword); 711 selected_keyword_view_->SetKeyword(keyword);
687 const TemplateURL* template_url = 712 const TemplateURL* template_url =
688 TemplateURLServiceFactory::GetForProfile(profile_)-> 713 TemplateURLServiceFactory::GetForProfile(profile_)->
689 GetTemplateURLForKeyword(keyword); 714 GetTemplateURLForKeyword(keyword);
690 if (template_url && template_url->IsExtensionKeyword()) { 715 if (template_url && template_url->IsExtensionKeyword()) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 web_intents_button_view_->GetBuiltInHorizontalPadding(), 781 web_intents_button_view_->GetBuiltInHorizontalPadding(),
757 web_intents_button_view_); 782 web_intents_button_view_);
758 } 783 }
759 if (show_keyword_hint) { 784 if (show_keyword_hint) {
760 right_decorations.AddDecoration( 785 right_decorations.AddDecoration(
761 kVerticalEdgeThickness, 0, true, 0, GetEdgeItemPadding(), 786 kVerticalEdgeThickness, 0, true, 0, GetEdgeItemPadding(),
762 GetItemPadding(), 0, keyword_hint_view_); 787 GetItemPadding(), 0, keyword_hint_view_);
763 if (keyword_hint_view_->keyword() != keyword) 788 if (keyword_hint_view_->keyword() != keyword)
764 keyword_hint_view_->SetKeyword(keyword); 789 keyword_hint_view_->SetKeyword(keyword);
765 } 790 }
791 if (search_token_view_->has_search_provider()) {
beaudoin 2013/01/07 17:27:53 Add a comment to indicate this must absolutely be
kuan 2013/01/09 19:52:58 Done.
792 right_decorations.AddDecoration(
793 kVerticalEdgeThickness, location_height, true, 0, GetEdgeItemPadding(),
794 GetItemPadding(), 0, search_token_view_);
beaudoin 2013/01/07 22:18:40 "true" means this component is auto-collapsible. A
kuan 2013/01/09 19:52:58 Done. yes, it is auto-collapsible.
795 right_decorations.set_item_edit_padding(
796 views::kUnrelatedControlLargeHorizontalSpacing);
797 }
766 798
767 // Perform layout. 799 // Perform layout.
768 int full_width = width() - 2 * kEdgeThickness; 800 int full_width = width() - 2 * kEdgeThickness;
769 int entry_width = full_width; 801 int entry_width = full_width;
770 left_decorations.LayoutPass1(&entry_width); 802 left_decorations.LayoutPass1(&entry_width);
771 right_decorations.LayoutPass1(&entry_width); 803 right_decorations.LayoutPass1(&entry_width);
772 left_decorations.LayoutPass2(&entry_width); 804 left_decorations.LayoutPass2(&entry_width);
773 right_decorations.LayoutPass2(&entry_width); 805 right_decorations.LayoutPass2(&entry_width);
774 806
775 int available_width = entry_width - location_entry_->TextWidth(); 807 int available_width = entry_width - location_entry_->TextWidth();
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 int LocationBarView::GetInternalHeight(bool use_preferred_size) { 1465 int LocationBarView::GetInternalHeight(bool use_preferred_size) {
1434 int total_height = 1466 int total_height =
1435 use_preferred_size ? GetPreferredSize().height() : height(); 1467 use_preferred_size ? GetPreferredSize().height() : height();
1436 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); 1468 return std::max(total_height - (kVerticalEdgeThickness * 2), 0);
1437 } 1469 }
1438 1470
1439 bool LocationBarView::HasValidSuggestText() const { 1471 bool LocationBarView::HasValidSuggestText() const {
1440 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && 1472 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() &&
1441 !suggested_text_view_->text().empty(); 1473 !suggested_text_view_->text().empty();
1442 } 1474 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698