| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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" |
| 11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 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" |
| 49 #include "chrome/browser/ui/views/location_bar/search_token_view.h" |
| 48 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" | 50 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" |
| 49 #include "chrome/browser/ui/views/location_bar/star_view.h" | 51 #include "chrome/browser/ui/views/location_bar/star_view.h" |
| 50 #include "chrome/browser/ui/views/location_bar/web_intents_button_view.h" | 52 #include "chrome/browser/ui/views/location_bar/web_intents_button_view.h" |
| 51 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" | 53 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" |
| 52 #include "chrome/browser/ui/views/location_bar/zoom_view.h" | 54 #include "chrome/browser/ui/views/location_bar/zoom_view.h" |
| 53 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 55 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 54 #include "chrome/browser/ui/views/omnibox/omnibox_views.h" | 56 #include "chrome/browser/ui/views/omnibox/omnibox_views.h" |
| 55 #include "chrome/browser/ui/zoom/zoom_controller.h" | 57 #include "chrome/browser/ui/zoom/zoom_controller.h" |
| 56 #include "chrome/common/chrome_notification_types.h" | 58 #include "chrome/common/chrome_notification_types.h" |
| 57 #include "chrome/common/extensions/feature_switch.h" | 59 #include "chrome/common/extensions/feature_switch.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 69 #include "ui/base/resource/resource_bundle.h" | 71 #include "ui/base/resource/resource_bundle.h" |
| 70 #include "ui/base/theme_provider.h" | 72 #include "ui/base/theme_provider.h" |
| 71 #include "ui/gfx/canvas.h" | 73 #include "ui/gfx/canvas.h" |
| 72 #include "ui/gfx/color_utils.h" | 74 #include "ui/gfx/color_utils.h" |
| 73 #include "ui/gfx/image/image.h" | 75 #include "ui/gfx/image/image.h" |
| 74 #include "ui/gfx/image/image_skia_operations.h" | 76 #include "ui/gfx/image/image_skia_operations.h" |
| 75 #include "ui/gfx/skia_util.h" | 77 #include "ui/gfx/skia_util.h" |
| 76 #include "ui/views/border.h" | 78 #include "ui/views/border.h" |
| 77 #include "ui/views/button_drag_utils.h" | 79 #include "ui/views/button_drag_utils.h" |
| 78 #include "ui/views/controls/label.h" | 80 #include "ui/views/controls/label.h" |
| 81 #include "ui/views/layout/layout_constants.h" |
| 79 #include "ui/views/widget/widget.h" | 82 #include "ui/views/widget/widget.h" |
| 80 | 83 |
| 81 #if defined(OS_WIN) | 84 #if defined(OS_WIN) |
| 82 #include "ui/native_theme/native_theme_win.h" | 85 #include "ui/native_theme/native_theme_win.h" |
| 83 #endif | 86 #endif |
| 84 | 87 |
| 85 #if defined(OS_WIN) && !defined(USE_AURA) | 88 #if defined(OS_WIN) && !defined(USE_AURA) |
| 86 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" | 89 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" |
| 87 #endif | 90 #endif |
| 88 | 91 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 disposition_(CURRENT_TAB), | 174 disposition_(CURRENT_TAB), |
| 172 transition_(content::PageTransitionFromInt( | 175 transition_(content::PageTransitionFromInt( |
| 173 content::PAGE_TRANSITION_TYPED | | 176 content::PAGE_TRANSITION_TYPED | |
| 174 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)), | 177 content::PAGE_TRANSITION_FROM_ADDRESS_BAR)), |
| 175 location_icon_view_(NULL), | 178 location_icon_view_(NULL), |
| 176 ev_bubble_view_(NULL), | 179 ev_bubble_view_(NULL), |
| 177 location_entry_view_(NULL), | 180 location_entry_view_(NULL), |
| 178 selected_keyword_view_(NULL), | 181 selected_keyword_view_(NULL), |
| 179 suggested_text_view_(NULL), | 182 suggested_text_view_(NULL), |
| 180 keyword_hint_view_(NULL), | 183 keyword_hint_view_(NULL), |
| 184 search_token_view_(NULL), |
| 185 search_token_separator_view_(NULL), |
| 181 zoom_view_(NULL), | 186 zoom_view_(NULL), |
| 182 open_pdf_in_reader_view_(NULL), | 187 open_pdf_in_reader_view_(NULL), |
| 183 script_bubble_icon_view_(NULL), | 188 script_bubble_icon_view_(NULL), |
| 184 star_view_(NULL), | 189 star_view_(NULL), |
| 185 web_intents_button_view_(NULL), | 190 web_intents_button_view_(NULL), |
| 186 action_box_button_view_(NULL), | 191 action_box_button_view_(NULL), |
| 187 mode_(mode), | 192 mode_(mode), |
| 188 show_focus_rect_(false), | 193 show_focus_rect_(false), |
| 189 template_url_service_(NULL), | 194 template_url_service_(NULL), |
| 190 animation_offset_(0) { | 195 animation_offset_(0) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // Use a larger version of the system font. | 229 // Use a larger version of the system font. |
| 225 font_ = rb.GetFont(ui::ResourceBundle::MediumFont); | 230 font_ = rb.GetFont(ui::ResourceBundle::MediumFont); |
| 226 } | 231 } |
| 227 | 232 |
| 228 // If this makes the font too big, try to make it smaller so it will fit. | 233 // If this makes the font too big, try to make it smaller so it will fit. |
| 229 const int height = GetInternalHeight(true); | 234 const int height = GetInternalHeight(true); |
| 230 while ((font_.GetHeight() > height) && (font_.GetFontSize() > 1)) | 235 while ((font_.GetHeight() > height) && (font_.GetFontSize() > 1)) |
| 231 font_ = font_.DeriveFont(-1); | 236 font_ = font_.DeriveFont(-1); |
| 232 | 237 |
| 233 location_icon_view_ = new LocationIconView(this); | 238 location_icon_view_ = new LocationIconView(this); |
| 234 AddChildView(location_icon_view_); | |
| 235 location_icon_view_->SetVisible(true); | 239 location_icon_view_->SetVisible(true); |
| 236 location_icon_view_->set_drag_controller(this); | 240 location_icon_view_->set_drag_controller(this); |
| 241 AddChildView(location_icon_view_); |
| 237 | 242 |
| 238 ev_bubble_view_ = | 243 ev_bubble_view_ = |
| 239 new EVBubbleView(kEVBubbleBackgroundImages, IDR_OMNIBOX_HTTPS_VALID, | 244 new EVBubbleView(kEVBubbleBackgroundImages, IDR_OMNIBOX_HTTPS_VALID, |
| 240 GetColor(ToolbarModel::EV_SECURE, SECURITY_TEXT), | 245 GetColor(ToolbarModel::EV_SECURE, SECURITY_TEXT), |
| 241 this); | 246 this); |
| 242 AddChildView(ev_bubble_view_); | |
| 243 ev_bubble_view_->SetVisible(false); | 247 ev_bubble_view_->SetVisible(false); |
| 244 ev_bubble_view_->set_drag_controller(this); | 248 ev_bubble_view_->set_drag_controller(this); |
| 249 AddChildView(ev_bubble_view_); |
| 245 | 250 |
| 246 // URL edit field. | 251 // URL edit field. |
| 247 // View container for URL edit field. | 252 // View container for URL edit field. |
| 248 location_entry_.reset(CreateOmniboxView(this, model_, profile_, | 253 location_entry_.reset(CreateOmniboxView(this, model_, profile_, |
| 249 command_updater_, mode_ == POPUP, this)); | 254 command_updater_, mode_ == POPUP, this)); |
| 250 SetLocationEntryFocusable(true); | 255 SetLocationEntryFocusable(true); |
| 251 | 256 |
| 252 location_entry_view_ = location_entry_->AddToView(this); | 257 location_entry_view_ = location_entry_->AddToView(this); |
| 253 location_entry_view_->set_id(VIEW_ID_AUTOCOMPLETE); | 258 location_entry_view_->set_id(VIEW_ID_AUTOCOMPLETE); |
| 254 | 259 |
| 255 selected_keyword_view_ = new SelectedKeywordView( | 260 selected_keyword_view_ = new SelectedKeywordView( |
| 256 kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER, | 261 kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER, |
| 257 GetColor(ToolbarModel::NONE, TEXT), | 262 GetColor(ToolbarModel::NONE, TEXT), |
| 258 profile_); | 263 profile_); |
| 264 selected_keyword_view_->SetVisible(false); |
| 265 selected_keyword_view_->SetFont(font_); |
| 259 AddChildView(selected_keyword_view_); | 266 AddChildView(selected_keyword_view_); |
| 260 selected_keyword_view_->SetFont(font_); | |
| 261 selected_keyword_view_->SetVisible(false); | |
| 262 | 267 |
| 263 keyword_hint_view_ = new KeywordHintView(profile_, this); | 268 keyword_hint_view_ = new KeywordHintView(profile_, this); |
| 264 AddChildView(keyword_hint_view_); | |
| 265 keyword_hint_view_->SetVisible(false); | 269 keyword_hint_view_->SetVisible(false); |
| 266 keyword_hint_view_->SetFont(font_); | 270 keyword_hint_view_->SetFont(font_); |
| 271 AddChildView(keyword_hint_view_); |
| 272 |
| 273 search_token_view_ = new SearchTokenView(); |
| 274 search_token_view_->SetVisible(false); |
| 275 search_token_view_->SetFont(font_); |
| 276 AddChildView(search_token_view_); |
| 277 search_token_separator_view_ = new LocationBarSeparatorView(); |
| 278 search_token_separator_view_->SetVisible(false); |
| 279 AddChildView(search_token_separator_view_); |
| 267 | 280 |
| 268 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 281 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
| 269 ContentSettingImageView* content_blocked_view = | 282 ContentSettingImageView* content_blocked_view = |
| 270 new ContentSettingImageView(static_cast<ContentSettingsType>(i), | 283 new ContentSettingImageView(static_cast<ContentSettingsType>(i), |
| 271 kCSBubbleBackgroundImages, this, | 284 kCSBubbleBackgroundImages, this, |
| 272 font_, | 285 font_, |
| 273 GetColor(ToolbarModel::NONE, TEXT)); | 286 GetColor(ToolbarModel::NONE, TEXT)); |
| 274 content_setting_views_.push_back(content_blocked_view); | 287 content_setting_views_.push_back(content_blocked_view); |
| 288 content_blocked_view->SetVisible(false); |
| 275 AddChildView(content_blocked_view); | 289 AddChildView(content_blocked_view); |
| 276 content_blocked_view->SetVisible(false); | |
| 277 } | 290 } |
| 278 | 291 |
| 279 zoom_view_ = new ZoomView(model_, delegate_); | 292 zoom_view_ = new ZoomView(model_, delegate_); |
| 280 zoom_view_->set_id(VIEW_ID_ZOOM_BUTTON); | 293 zoom_view_->set_id(VIEW_ID_ZOOM_BUTTON); |
| 281 AddChildView(zoom_view_); | 294 AddChildView(zoom_view_); |
| 282 | 295 |
| 283 web_intents_button_view_ = | 296 web_intents_button_view_ = |
| 284 new WebIntentsButtonView(this, kWIBubbleBackgroundImages, font_, | 297 new WebIntentsButtonView(this, kWIBubbleBackgroundImages, font_, |
| 285 GetColor(ToolbarModel::NONE, TEXT)); | 298 GetColor(ToolbarModel::NONE, TEXT)); |
| 286 AddChildView(web_intents_button_view_); | 299 AddChildView(web_intents_button_view_); |
| 287 | 300 |
| 288 open_pdf_in_reader_view_ = new OpenPDFInReaderView(this); | 301 open_pdf_in_reader_view_ = new OpenPDFInReaderView(this); |
| 289 AddChildView(open_pdf_in_reader_view_); | 302 AddChildView(open_pdf_in_reader_view_); |
| 290 | 303 |
| 291 script_bubble_icon_view_ = new ScriptBubbleIconView(delegate()); | 304 script_bubble_icon_view_ = new ScriptBubbleIconView(delegate()); |
| 305 script_bubble_icon_view_->SetVisible(false); |
| 292 AddChildView(script_bubble_icon_view_); | 306 AddChildView(script_bubble_icon_view_); |
| 293 script_bubble_icon_view_->SetVisible(false); | |
| 294 | 307 |
| 295 if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { | 308 if (browser_defaults::bookmarks_enabled && (mode_ == NORMAL)) { |
| 296 // Note: condition above means that the star icon is hidden in popups and in | 309 // Note: condition above means that the star icon is hidden in popups and in |
| 297 // the app launcher. | 310 // the app launcher. |
| 298 star_view_ = new StarView(command_updater_); | 311 star_view_ = new StarView(command_updater_); |
| 312 star_view_->SetVisible(true); |
| 299 AddChildView(star_view_); | 313 AddChildView(star_view_); |
| 300 star_view_->SetVisible(true); | |
| 301 } | 314 } |
| 302 if (extensions::FeatureSwitch::action_box()->IsEnabled() && | 315 if (extensions::FeatureSwitch::action_box()->IsEnabled() && |
| 303 mode_ == NORMAL && browser_) { | 316 mode_ == NORMAL && browser_) { |
| 317 if (star_view_) |
| 318 star_view_->SetVisible(false); |
| 319 |
| 304 action_box_button_view_ = new ActionBoxButtonView(browser_, | 320 action_box_button_view_ = new ActionBoxButtonView(browser_, |
| 305 gfx::Point(kNormalHorizontalEdgeThickness, kVerticalEdgeThickness)); | 321 gfx::Point(kNormalHorizontalEdgeThickness, kVerticalEdgeThickness)); |
| 306 AddChildView(action_box_button_view_); | 322 AddChildView(action_box_button_view_); |
| 307 | |
| 308 if (star_view_) | |
| 309 star_view_->SetVisible(false); | |
| 310 } | 323 } |
| 311 | 324 |
| 312 registrar_.Add(this, | 325 registrar_.Add(this, |
| 313 chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, | 326 chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, |
| 314 content::Source<Profile>(profile_)); | 327 content::Source<Profile>(profile_)); |
| 315 | 328 |
| 316 // Initialize the location entry. We do this to avoid a black flash which is | 329 // Initialize the location entry. We do this to avoid a black flash which is |
| 317 // visible when the location entry has just been initialized. | 330 // visible when the location entry has just been initialized. |
| 318 Update(NULL); | 331 Update(NULL); |
| 319 | 332 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 | 431 |
| 419 bool star_enabled = star_view_ && !model_->GetInputInProgress() && | 432 bool star_enabled = star_view_ && !model_->GetInputInProgress() && |
| 420 edit_bookmarks_enabled_.GetValue(); | 433 edit_bookmarks_enabled_.GetValue(); |
| 421 | 434 |
| 422 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); | 435 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled); |
| 423 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE_FROM_STAR, | 436 command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE_FROM_STAR, |
| 424 star_enabled); | 437 star_enabled); |
| 425 if (star_view_ && !extensions::FeatureSwitch::action_box()->IsEnabled()) | 438 if (star_view_ && !extensions::FeatureSwitch::action_box()->IsEnabled()) |
| 426 star_view_->SetVisible(star_enabled); | 439 star_view_->SetVisible(star_enabled); |
| 427 | 440 |
| 441 string16 search_provider; |
| 442 if (!model_->GetInputInProgress() && |
| 443 model_->WouldReplaceSearchURLWithSearchTerms()) { |
| 444 const TemplateURL* template_url = |
| 445 TemplateURLServiceFactory::GetForProfile(profile_)-> |
| 446 GetDefaultSearchProvider(); |
| 447 if (template_url) { |
| 448 search_provider = template_url->short_name(); |
| 449 search_token_view_->SetBackgroundColor(GetColor( |
| 450 model_->GetSecurityLevel(), LocationBarView::BACKGROUND)); |
| 451 SkColor text_color = GetColor( |
| 452 model_->GetSecurityLevel(), LocationBarView::DEEMPHASIZED_TEXT); |
| 453 search_token_view_->SetForegroundColor(text_color); |
| 454 search_token_separator_view_->set_separator_color( |
| 455 SkColorSetA(text_color, 64)); // 25% alpha. |
| 456 } |
| 457 } |
| 458 search_token_view_->SetSearchProvider(search_provider); |
| 459 |
| 428 // Don't Update in app launcher mode so that the location entry does not show | 460 // Don't Update in app launcher mode so that the location entry does not show |
| 429 // a URL or security background. | 461 // a URL or security background. |
| 430 if (mode_ != APP_LAUNCHER) | 462 if (mode_ != APP_LAUNCHER) |
| 431 location_entry_->Update(tab_for_state_restoring); | 463 location_entry_->Update(tab_for_state_restoring); |
| 432 OnChanged(); | 464 OnChanged(); |
| 433 } | 465 } |
| 434 | 466 |
| 435 void LocationBarView::UpdateContentSettingsIcons() { | 467 void LocationBarView::UpdateContentSettingsIcons() { |
| 436 RefreshContentSettingViews(); | 468 RefreshContentSettingViews(); |
| 437 | 469 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 | 698 |
| 667 LocationBarLayout left_decorations(LocationBarLayout::LEFT_EDGE, | 699 LocationBarLayout left_decorations(LocationBarLayout::LEFT_EDGE, |
| 668 kItemEditPadding, kEdgeEditPadding); | 700 kItemEditPadding, kEdgeEditPadding); |
| 669 LocationBarLayout right_decorations(LocationBarLayout::RIGHT_EDGE, | 701 LocationBarLayout right_decorations(LocationBarLayout::RIGHT_EDGE, |
| 670 kItemEditPadding, kEdgeEditPadding); | 702 kItemEditPadding, kEdgeEditPadding); |
| 671 | 703 |
| 672 selected_keyword_view_->SetVisible(false); | 704 selected_keyword_view_->SetVisible(false); |
| 673 location_icon_view_->SetVisible(false); | 705 location_icon_view_->SetVisible(false); |
| 674 ev_bubble_view_->SetVisible(false); | 706 ev_bubble_view_->SetVisible(false); |
| 675 keyword_hint_view_->SetVisible(false); | 707 keyword_hint_view_->SetVisible(false); |
| 708 search_token_view_->SetVisible(false); |
| 709 search_token_separator_view_->SetVisible(false); |
| 676 | 710 |
| 677 const string16 keyword(location_entry_->model()->keyword()); | 711 const string16 keyword(location_entry_->model()->keyword()); |
| 678 const bool is_keyword_hint(location_entry_->model()->is_keyword_hint()); | 712 const bool is_keyword_hint(location_entry_->model()->is_keyword_hint()); |
| 679 const bool show_selected_keyword = !keyword.empty() && !is_keyword_hint; | 713 const bool show_search_token = search_token_view_->has_search_provider(); |
| 680 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint; | 714 const bool show_selected_keyword = !keyword.empty() && !is_keyword_hint && |
| 715 !show_search_token; |
| 716 const bool show_keyword_hint = !keyword.empty() && is_keyword_hint && |
| 717 !show_search_token; |
| 681 if (show_selected_keyword) { | 718 if (show_selected_keyword) { |
| 682 left_decorations.AddDecoration( | 719 left_decorations.AddDecoration( |
| 683 kBubbleLocationY, 0, true, 0, kBubbleHorizontalPadding, | 720 kBubbleLocationY, 0, true, 0, kBubbleHorizontalPadding, |
| 684 GetItemPadding(), 0, selected_keyword_view_); | 721 GetItemPadding(), 0, selected_keyword_view_); |
| 685 if (selected_keyword_view_->keyword() != keyword) { | 722 if (selected_keyword_view_->keyword() != keyword) { |
| 686 selected_keyword_view_->SetKeyword(keyword); | 723 selected_keyword_view_->SetKeyword(keyword); |
| 687 const TemplateURL* template_url = | 724 const TemplateURL* template_url = |
| 688 TemplateURLServiceFactory::GetForProfile(profile_)-> | 725 TemplateURLServiceFactory::GetForProfile(profile_)-> |
| 689 GetTemplateURLForKeyword(keyword); | 726 GetTemplateURLForKeyword(keyword); |
| 690 if (template_url && template_url->IsExtensionKeyword()) { | 727 if (template_url && template_url->IsExtensionKeyword()) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 web_intents_button_view_->GetBuiltInHorizontalPadding(), | 793 web_intents_button_view_->GetBuiltInHorizontalPadding(), |
| 757 web_intents_button_view_); | 794 web_intents_button_view_); |
| 758 } | 795 } |
| 759 if (show_keyword_hint) { | 796 if (show_keyword_hint) { |
| 760 right_decorations.AddDecoration( | 797 right_decorations.AddDecoration( |
| 761 kVerticalEdgeThickness, 0, true, 0, GetEdgeItemPadding(), | 798 kVerticalEdgeThickness, 0, true, 0, GetEdgeItemPadding(), |
| 762 GetItemPadding(), 0, keyword_hint_view_); | 799 GetItemPadding(), 0, keyword_hint_view_); |
| 763 if (keyword_hint_view_->keyword() != keyword) | 800 if (keyword_hint_view_->keyword() != keyword) |
| 764 keyword_hint_view_->SetKeyword(keyword); | 801 keyword_hint_view_->SetKeyword(keyword); |
| 765 } | 802 } |
| 803 if (show_search_token) { |
| 804 // This must be the last item in the right decorations list, otherwise |
| 805 // right_decorations.set_item_padding() makes no sense. |
| 806 right_decorations.AddDecorationWithSeparator( |
| 807 kVerticalEdgeThickness, location_height, true, 0, GetEdgeItemPadding(), |
| 808 GetItemPadding(), 0, LocationBarLayout::SEPARATOR_BEFORE, |
| 809 GetItemPadding() * 2, 0, search_token_view_, |
| 810 search_token_separator_view_); |
| 811 right_decorations.set_item_edit_padding( |
| 812 views::kUnrelatedControlLargeHorizontalSpacing); |
| 813 } |
| 766 | 814 |
| 767 // Perform layout. | 815 // Perform layout. |
| 768 int full_width = width() - 2 * kEdgeThickness; | 816 int full_width = width() - 2 * kEdgeThickness; |
| 769 int entry_width = full_width; | 817 int entry_width = full_width; |
| 770 left_decorations.LayoutPass1(&entry_width); | 818 left_decorations.LayoutPass1(&entry_width); |
| 771 right_decorations.LayoutPass1(&entry_width); | 819 right_decorations.LayoutPass1(&entry_width); |
| 772 left_decorations.LayoutPass2(&entry_width); | 820 left_decorations.LayoutPass2(&entry_width); |
| 773 right_decorations.LayoutPass2(&entry_width); | 821 right_decorations.LayoutPass2(&entry_width); |
| 774 | 822 |
| 775 int available_width = entry_width - location_entry_->TextWidth(); | 823 int available_width = entry_width - location_entry_->TextWidth(); |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1433 int LocationBarView::GetInternalHeight(bool use_preferred_size) { | 1481 int LocationBarView::GetInternalHeight(bool use_preferred_size) { |
| 1434 int total_height = | 1482 int total_height = |
| 1435 use_preferred_size ? GetPreferredSize().height() : height(); | 1483 use_preferred_size ? GetPreferredSize().height() : height(); |
| 1436 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); | 1484 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); |
| 1437 } | 1485 } |
| 1438 | 1486 |
| 1439 bool LocationBarView::HasValidSuggestText() const { | 1487 bool LocationBarView::HasValidSuggestText() const { |
| 1440 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && | 1488 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && |
| 1441 !suggested_text_view_->text().empty(); | 1489 !suggested_text_view_->text().empty(); |
| 1442 } | 1490 } |
| OLD | NEW |