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

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: addressed nits from peter 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
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | 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/command_line.h" 10 #include "base/command_line.h"
(...skipping 22 matching lines...) Expand all
33 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" 33 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h"
34 #include "chrome/browser/ui/view_ids.h" 34 #include "chrome/browser/ui/view_ids.h"
35 #include "chrome/browser/ui/views/bookmarks/bookmark_prompt_view.h" 35 #include "chrome/browser/ui/views/bookmarks/bookmark_prompt_view.h"
36 #include "chrome/browser/ui/views/browser_dialogs.h" 36 #include "chrome/browser/ui/views/browser_dialogs.h"
37 #include "chrome/browser/ui/views/extensions/extension_popup.h" 37 #include "chrome/browser/ui/views/extensions/extension_popup.h"
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_bar_separator_view.h"
43 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" 44 #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" 45 #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" 46 #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" 47 #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" 48 #include "chrome/browser/ui/views/location_bar/script_bubble_icon_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"
(...skipping 16 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),
184 search_token_separator_view_(NULL),
181 zoom_view_(NULL), 185 zoom_view_(NULL),
182 open_pdf_in_reader_view_(NULL), 186 open_pdf_in_reader_view_(NULL),
183 script_bubble_icon_view_(NULL), 187 script_bubble_icon_view_(NULL),
184 star_view_(NULL), 188 star_view_(NULL),
185 web_intents_button_view_(NULL), 189 web_intents_button_view_(NULL),
186 action_box_button_view_(NULL), 190 action_box_button_view_(NULL),
187 mode_(mode), 191 mode_(mode),
188 show_focus_rect_(false), 192 show_focus_rect_(false),
189 template_url_service_(NULL), 193 template_url_service_(NULL),
190 animation_offset_(0) { 194 animation_offset_(0) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // Use a larger version of the system font. 228 // Use a larger version of the system font.
225 font_ = rb.GetFont(ui::ResourceBundle::MediumFont); 229 font_ = rb.GetFont(ui::ResourceBundle::MediumFont);
226 } 230 }
227 231
228 // If this makes the font too big, try to make it smaller so it will fit. 232 // If this makes the font too big, try to make it smaller so it will fit.
229 const int height = GetInternalHeight(true); 233 const int height = GetInternalHeight(true);
230 while ((font_.GetHeight() > height) && (font_.GetFontSize() > 1)) 234 while ((font_.GetHeight() > height) && (font_.GetFontSize() > 1))
231 font_ = font_.DeriveFont(-1); 235 font_ = font_.DeriveFont(-1);
232 236
233 location_icon_view_ = new LocationIconView(this); 237 location_icon_view_ = new LocationIconView(this);
238 location_icon_view_->set_drag_controller(this);
234 AddChildView(location_icon_view_); 239 AddChildView(location_icon_view_);
235 location_icon_view_->SetVisible(true);
236 location_icon_view_->set_drag_controller(this);
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);
245 ev_bubble_view_->set_drag_controller(this);
242 AddChildView(ev_bubble_view_); 246 AddChildView(ev_bubble_view_);
243 ev_bubble_view_->SetVisible(false);
244 ev_bubble_view_->set_drag_controller(this);
245 247
246 // URL edit field. 248 // URL edit field.
247 // View container for URL edit field. 249 // View container for URL edit field.
248 location_entry_.reset(CreateOmniboxView(this, model_, profile_, 250 location_entry_.reset(CreateOmniboxView(this, model_, profile_,
249 command_updater_, mode_ == POPUP, this)); 251 command_updater_, mode_ == POPUP, this));
250 SetLocationEntryFocusable(true); 252 SetLocationEntryFocusable(true);
251 253
252 location_entry_view_ = location_entry_->AddToView(this); 254 location_entry_view_ = location_entry_->AddToView(this);
253 location_entry_view_->set_id(VIEW_ID_AUTOCOMPLETE); 255 location_entry_view_->set_id(VIEW_ID_AUTOCOMPLETE);
254 256
255 selected_keyword_view_ = new SelectedKeywordView( 257 selected_keyword_view_ = new SelectedKeywordView(
256 kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER, 258 kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER,
257 GetColor(ToolbarModel::NONE, TEXT), 259 GetColor(ToolbarModel::NONE, TEXT),
258 profile_); 260 profile_);
261 selected_keyword_view_->SetFont(font_);
259 AddChildView(selected_keyword_view_); 262 AddChildView(selected_keyword_view_);
260 selected_keyword_view_->SetFont(font_);
261 selected_keyword_view_->SetVisible(false);
262 263
263 keyword_hint_view_ = new KeywordHintView(profile_, this); 264 keyword_hint_view_ = new KeywordHintView(profile_, this);
265 keyword_hint_view_->SetFont(font_);
264 AddChildView(keyword_hint_view_); 266 AddChildView(keyword_hint_view_);
265 keyword_hint_view_->SetVisible(false); 267
266 keyword_hint_view_->SetFont(font_); 268 search_token_view_ = new views::Label(string16(), font_);
269 search_token_view_->SetAutoColorReadabilityEnabled(false);
270 AddChildView(search_token_view_);
271 search_token_separator_view_ = new LocationBarSeparatorView();
272 AddChildView(search_token_separator_view_);
267 273
268 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { 274 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
269 ContentSettingImageView* content_blocked_view = 275 ContentSettingImageView* content_blocked_view =
270 new ContentSettingImageView(static_cast<ContentSettingsType>(i), 276 new ContentSettingImageView(static_cast<ContentSettingsType>(i),
271 kCSBubbleBackgroundImages, this, 277 kCSBubbleBackgroundImages, this,
272 font_, 278 font_,
273 GetColor(ToolbarModel::NONE, TEXT)); 279 GetColor(ToolbarModel::NONE, TEXT));
274 content_setting_views_.push_back(content_blocked_view); 280 content_setting_views_.push_back(content_blocked_view);
281 content_blocked_view->SetVisible(false);
275 AddChildView(content_blocked_view); 282 AddChildView(content_blocked_view);
276 content_blocked_view->SetVisible(false);
277 } 283 }
278 284
279 zoom_view_ = new ZoomView(model_, delegate_); 285 zoom_view_ = new ZoomView(model_, delegate_);
280 zoom_view_->set_id(VIEW_ID_ZOOM_BUTTON); 286 zoom_view_->set_id(VIEW_ID_ZOOM_BUTTON);
281 AddChildView(zoom_view_); 287 AddChildView(zoom_view_);
282 288
283 web_intents_button_view_ = 289 web_intents_button_view_ =
284 new WebIntentsButtonView(this, kWIBubbleBackgroundImages, font_, 290 new WebIntentsButtonView(this, kWIBubbleBackgroundImages, font_,
285 GetColor(ToolbarModel::NONE, TEXT)); 291 GetColor(ToolbarModel::NONE, TEXT));
286 AddChildView(web_intents_button_view_); 292 AddChildView(web_intents_button_view_);
287 293
288 open_pdf_in_reader_view_ = new OpenPDFInReaderView(this); 294 open_pdf_in_reader_view_ = new OpenPDFInReaderView(this);
289 AddChildView(open_pdf_in_reader_view_); 295 AddChildView(open_pdf_in_reader_view_);
290 296
291 script_bubble_icon_view_ = new ScriptBubbleIconView(delegate()); 297 script_bubble_icon_view_ = new ScriptBubbleIconView(delegate());
298 script_bubble_icon_view_->SetVisible(false);
292 AddChildView(script_bubble_icon_view_); 299 AddChildView(script_bubble_icon_view_);
293 script_bubble_icon_view_->SetVisible(false);
294 300
295 if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { 301 if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) {
296 // Note: condition above means that the star icon is hidden in popups and in 302 // Note: condition above means that the star icon is hidden in popups and in
297 // the app launcher. 303 // the app launcher.
298 star_view_ = new StarView(command_updater_); 304 star_view_ = new StarView(command_updater_);
305 star_view_->SetVisible(true);
299 AddChildView(star_view_); 306 AddChildView(star_view_);
300 star_view_->SetVisible(true);
301 } 307 }
302 if (extensions::FeatureSwitch::action_box()->IsEnabled() && 308 if (extensions::FeatureSwitch::action_box()->IsEnabled() &&
303 mode_ == NORMAL && browser_) { 309 mode_ == NORMAL && browser_) {
310 if (star_view_)
311 star_view_->SetVisible(false);
312
304 action_box_button_view_ = new ActionBoxButtonView(browser_, 313 action_box_button_view_ = new ActionBoxButtonView(browser_,
305 gfx::Point(kNormalHorizontalEdgeThickness, kVerticalEdgeThickness)); 314 gfx::Point(kNormalHorizontalEdgeThickness, kVerticalEdgeThickness));
306 AddChildView(action_box_button_view_); 315 AddChildView(action_box_button_view_);
307
308 if (star_view_)
309 star_view_->SetVisible(false);
310 } 316 }
311 317
312 registrar_.Add(this, 318 registrar_.Add(this,
313 chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, 319 chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED,
314 content::Source<Profile>(profile_)); 320 content::Source<Profile>(profile_));
315 321
316 // Initialize the location entry. We do this to avoid a black flash which is 322 // Initialize the location entry. We do this to avoid a black flash which is
317 // visible when the location entry has just been initialized. 323 // visible when the location entry has just been initialized.
318 Update(NULL); 324 Update(NULL);
319 325
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 424
419 bool star_enabled = star_view_ && !model_->GetInputInProgress() && 425 bool star_enabled = star_view_ && !model_->GetInputInProgress() &&
420 edit_bookmarks_enabled_.GetValue(); 426 edit_bookmarks_enabled_.GetValue();
421 427
422 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); 428 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled);
423 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE_FROM_STAR, 429 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE_FROM_STAR,
424 star_enabled); 430 star_enabled);
425 if (star_view_ && !extensions::FeatureSwitch::action_box()->IsEnabled()) 431 if (star_view_ && !extensions::FeatureSwitch::action_box()->IsEnabled())
426 star_view_->SetVisible(star_enabled); 432 star_view_->SetVisible(star_enabled);
427 433
434 string16 search_provider;
435 if (!model_->GetInputInProgress() &&
436 model_->WouldReplaceSearchURLWithSearchTerms()) {
437 const TemplateURL* template_url =
438 TemplateURLServiceFactory::GetForProfile(profile_)->
439 GetDefaultSearchProvider();
440 if (template_url && !template_url->short_name().empty()) {
441 search_provider = l10n_util::GetStringFUTF16(
442 IDS_OMNIBOX_SEARCH_TOKEN_TEXT, template_url->short_name());
443 search_token_view_->SetBackgroundColor(GetColor(
444 model_->GetSecurityLevel(), LocationBarView::BACKGROUND));
445 SkColor text_color = GetColor(
446 model_->GetSecurityLevel(), LocationBarView::DEEMPHASIZED_TEXT);
447 search_token_view_->SetEnabledColor(text_color);
448 search_token_separator_view_->set_separator_color(
449 SkColorSetA(text_color, 64)); // 25% alpha.
450 }
451 }
452 // If |search_provider| is empty, |search_token_view_| is hidden.
453 search_token_view_->SetText(search_provider);
454
428 // Don't Update in app launcher mode so that the location entry does not show 455 // Don't Update in app launcher mode so that the location entry does not show
429 // a URL or security background. 456 // a URL or security background.
430 if (mode_ != APP_LAUNCHER) 457 if (mode_ != APP_LAUNCHER)
431 location_entry_->Update(tab_for_state_restoring); 458 location_entry_->Update(tab_for_state_restoring);
432 OnChanged(); 459 OnChanged();
433 } 460 }
434 461
435 void LocationBarView::UpdateContentSettingsIcons() { 462 void LocationBarView::UpdateContentSettingsIcons() {
436 RefreshContentSettingViews(); 463 RefreshContentSettingViews();
437 464
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 693
667 LocationBarLayout left_decorations(LocationBarLayout::LEFT_EDGE, 694 LocationBarLayout left_decorations(LocationBarLayout::LEFT_EDGE,
668 kItemEditPadding, kEdgeEditPadding); 695 kItemEditPadding, kEdgeEditPadding);
669 LocationBarLayout right_decorations(LocationBarLayout::RIGHT_EDGE, 696 LocationBarLayout right_decorations(LocationBarLayout::RIGHT_EDGE,
670 kItemEditPadding, kEdgeEditPadding); 697 kItemEditPadding, kEdgeEditPadding);
671 698
672 selected_keyword_view_->SetVisible(false); 699 selected_keyword_view_->SetVisible(false);
673 location_icon_view_->SetVisible(false); 700 location_icon_view_->SetVisible(false);
674 ev_bubble_view_->SetVisible(false); 701 ev_bubble_view_->SetVisible(false);
675 keyword_hint_view_->SetVisible(false); 702 keyword_hint_view_->SetVisible(false);
703 search_token_view_->SetVisible(false);
704 search_token_separator_view_->SetVisible(false);
676 705
677 const string16 keyword(location_entry_->model()->keyword()); 706 const string16 keyword(location_entry_->model()->keyword());
678 const bool is_keyword_hint(location_entry_->model()->is_keyword_hint()); 707 const bool is_keyword_hint(location_entry_->model()->is_keyword_hint());
679 const bool show_selected_keyword = !keyword.empty() && !is_keyword_hint; 708 const bool show_search_token = !search_token_view_->text().empty();
680 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint; 709 const bool show_selected_keyword = !keyword.empty() && !is_keyword_hint &&
710 !show_search_token;
711 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint &&
712 !show_search_token;
681 if (show_selected_keyword) { 713 if (show_selected_keyword) {
682 left_decorations.AddDecoration( 714 left_decorations.AddDecoration(
683 kBubbleLocationY, 0, true, 0, kBubbleHorizontalPadding, 715 kBubbleLocationY, 0, true, 0, kBubbleHorizontalPadding,
684 GetItemPadding(), 0, selected_keyword_view_); 716 GetItemPadding(), 0, selected_keyword_view_);
685 if (selected_keyword_view_->keyword() != keyword) { 717 if (selected_keyword_view_->keyword() != keyword) {
686 selected_keyword_view_->SetKeyword(keyword); 718 selected_keyword_view_->SetKeyword(keyword);
687 const TemplateURL* template_url = 719 const TemplateURL* template_url =
688 TemplateURLServiceFactory::GetForProfile(profile_)-> 720 TemplateURLServiceFactory::GetForProfile(profile_)->
689 GetTemplateURLForKeyword(keyword); 721 GetTemplateURLForKeyword(keyword);
690 if (template_url && template_url->IsExtensionKeyword()) { 722 if (template_url && template_url->IsExtensionKeyword()) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 web_intents_button_view_->GetBuiltInHorizontalPadding(), 788 web_intents_button_view_->GetBuiltInHorizontalPadding(),
757 web_intents_button_view_); 789 web_intents_button_view_);
758 } 790 }
759 if (show_keyword_hint) { 791 if (show_keyword_hint) {
760 right_decorations.AddDecoration( 792 right_decorations.AddDecoration(
761 kVerticalEdgeThickness, 0, true, 0, GetEdgeItemPadding(), 793 kVerticalEdgeThickness, 0, true, 0, GetEdgeItemPadding(),
762 GetItemPadding(), 0, keyword_hint_view_); 794 GetItemPadding(), 0, keyword_hint_view_);
763 if (keyword_hint_view_->keyword() != keyword) 795 if (keyword_hint_view_->keyword() != keyword)
764 keyword_hint_view_->SetKeyword(keyword); 796 keyword_hint_view_->SetKeyword(keyword);
765 } 797 }
798 if (show_search_token) {
799 right_decorations.AddSeparator(kVerticalEdgeThickness, location_height,
800 GetItemPadding(), search_token_separator_view_);
801 // This must be the last item in the right decorations list, otherwise
802 // right_decorations.set_item_padding() makes no sense.
803 right_decorations.AddDecoration(
804 kVerticalEdgeThickness, location_height, true, 0, GetEdgeItemPadding(),
805 GetItemPadding() * 2, 0, search_token_view_);
806 right_decorations.set_item_edit_padding(
807 views::kUnrelatedControlLargeHorizontalSpacing);
808 }
766 809
767 // Perform layout. 810 // Perform layout.
768 int full_width = width() - 2 * kEdgeThickness; 811 int full_width = width() - 2 * kEdgeThickness;
769 int entry_width = full_width; 812 int entry_width = full_width;
770 left_decorations.LayoutPass1(&entry_width); 813 left_decorations.LayoutPass1(&entry_width);
771 right_decorations.LayoutPass1(&entry_width); 814 right_decorations.LayoutPass1(&entry_width);
772 left_decorations.LayoutPass2(&entry_width); 815 left_decorations.LayoutPass2(&entry_width);
773 right_decorations.LayoutPass2(&entry_width); 816 right_decorations.LayoutPass2(&entry_width);
774 817
775 int available_width = entry_width - location_entry_->TextWidth(); 818 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) { 1476 int LocationBarView::GetInternalHeight(bool use_preferred_size) {
1434 int total_height = 1477 int total_height =
1435 use_preferred_size ? GetPreferredSize().height() : height(); 1478 use_preferred_size ? GetPreferredSize().height() : height();
1436 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); 1479 return std::max(total_height - (kVerticalEdgeThickness * 2), 0);
1437 } 1480 }
1438 1481
1439 bool LocationBarView::HasValidSuggestText() const { 1482 bool LocationBarView::HasValidSuggestText() const {
1440 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && 1483 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() &&
1441 !suggested_text_view_->text().empty(); 1484 !suggested_text_view_->text().empty();
1442 } 1485 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698