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/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 14 #include "base/strings/string_split.h" | |
| 14 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 15 #include "chrome/app/chrome_command_ids.h" | 16 #include "chrome/app/chrome_command_ids.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 17 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/command_updater.h" | 18 #include "chrome/browser/command_updater.h" |
| 18 #include "chrome/browser/defaults.h" | 19 #include "chrome/browser/defaults.h" |
| 19 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" | 20 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" |
| 20 #include "chrome/browser/extensions/extension_service.h" | 21 #include "chrome/browser/extensions/extension_service.h" |
| 21 #include "chrome/browser/extensions/location_bar_controller.h" | 22 #include "chrome/browser/extensions/location_bar_controller.h" |
| 22 #include "chrome/browser/extensions/tab_helper.h" | 23 #include "chrome/browser/extensions/tab_helper.h" |
| 23 #include "chrome/browser/favicon/favicon_tab_helper.h" | 24 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/search/instant_service.h" | 26 #include "chrome/browser/search/instant_service.h" |
| 26 #include "chrome/browser/search/instant_service_factory.h" | 27 #include "chrome/browser/search/instant_service_factory.h" |
| 27 #include "chrome/browser/search/search.h" | 28 #include "chrome/browser/search/search.h" |
| 28 #include "chrome/browser/search_engines/template_url.h" | 29 #include "chrome/browser/search_engines/template_url.h" |
| 29 #include "chrome/browser/search_engines/template_url_service.h" | 30 #include "chrome/browser/search_engines/template_url_service.h" |
| 30 #include "chrome/browser/search_engines/template_url_service_factory.h" | 31 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 31 #include "chrome/browser/translate/translate_service.h" | 32 #include "chrome/browser/translate/translate_service.h" |
| 32 #include "chrome/browser/translate/translate_tab_helper.h" | 33 #include "chrome/browser/translate/translate_tab_helper.h" |
| 33 #include "chrome/browser/ui/browser.h" | 34 #include "chrome/browser/ui/browser.h" |
| 34 #include "chrome/browser/ui/browser_finder.h" | 35 #include "chrome/browser/ui/browser_finder.h" |
| 35 #include "chrome/browser/ui/browser_instant_controller.h" | 36 #include "chrome/browser/ui/browser_instant_controller.h" |
| 36 #include "chrome/browser/ui/browser_window.h" | 37 #include "chrome/browser/ui/browser_window.h" |
| 37 #include "chrome/browser/ui/omnibox/location_bar_util.h" | 38 #include "chrome/browser/ui/omnibox/location_bar_util.h" |
| 38 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 39 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
| 39 #include "chrome/browser/ui/omnibox/omnibox_popup_view.h" | 40 #include "chrome/browser/ui/omnibox/omnibox_popup_view.h" |
| 40 #include "chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.h" | 41 #include "chrome/browser/ui/passwords/manage_passwords_bubble_ui_controller.h" |
| 41 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 42 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 43 #include "chrome/browser/ui/toolbar/origin_chip_info.h" | |
| 42 #include "chrome/browser/ui/view_ids.h" | 44 #include "chrome/browser/ui/view_ids.h" |
| 43 #include "chrome/browser/ui/views/bookmarks/bookmark_prompt_view.h" | 45 #include "chrome/browser/ui/views/bookmarks/bookmark_prompt_view.h" |
| 44 #include "chrome/browser/ui/views/browser_dialogs.h" | 46 #include "chrome/browser/ui/views/browser_dialogs.h" |
| 45 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" | 47 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" |
| 46 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" | 48 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" |
| 47 #include "chrome/browser/ui/views/location_bar/generated_credit_card_view.h" | 49 #include "chrome/browser/ui/views/location_bar/generated_credit_card_view.h" |
| 48 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" | 50 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" |
| 49 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h" | 51 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h" |
| 50 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 52 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 51 #include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h" | 53 #include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 71 #include "extensions/common/permissions/permissions_data.h" | 73 #include "extensions/common/permissions/permissions_data.h" |
| 72 #include "grit/generated_resources.h" | 74 #include "grit/generated_resources.h" |
| 73 #include "grit/theme_resources.h" | 75 #include "grit/theme_resources.h" |
| 74 #include "ui/accessibility/ax_view_state.h" | 76 #include "ui/accessibility/ax_view_state.h" |
| 75 #include "ui/base/dragdrop/drag_drop_types.h" | 77 #include "ui/base/dragdrop/drag_drop_types.h" |
| 76 #include "ui/base/l10n/l10n_util.h" | 78 #include "ui/base/l10n/l10n_util.h" |
| 77 #include "ui/base/layout.h" | 79 #include "ui/base/layout.h" |
| 78 #include "ui/base/resource/resource_bundle.h" | 80 #include "ui/base/resource/resource_bundle.h" |
| 79 #include "ui/base/theme_provider.h" | 81 #include "ui/base/theme_provider.h" |
| 80 #include "ui/events/event.h" | 82 #include "ui/events/event.h" |
| 83 #include "ui/gfx/animation/slide_animation.h" | |
| 81 #include "ui/gfx/canvas.h" | 84 #include "ui/gfx/canvas.h" |
| 82 #include "ui/gfx/color_utils.h" | 85 #include "ui/gfx/color_utils.h" |
| 83 #include "ui/gfx/image/image.h" | 86 #include "ui/gfx/image/image.h" |
| 84 #include "ui/gfx/image/image_skia_operations.h" | 87 #include "ui/gfx/image/image_skia_operations.h" |
| 85 #include "ui/gfx/skia_util.h" | 88 #include "ui/gfx/skia_util.h" |
| 86 #include "ui/gfx/text_utils.h" | 89 #include "ui/gfx/text_utils.h" |
| 87 #include "ui/native_theme/native_theme.h" | 90 #include "ui/native_theme/native_theme.h" |
| 88 #include "ui/views/background.h" | 91 #include "ui/views/background.h" |
| 89 #include "ui/views/border.h" | 92 #include "ui/views/border.h" |
| 90 #include "ui/views/button_drag_utils.h" | 93 #include "ui/views/button_drag_utils.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 generated_credit_card_view_(NULL), | 216 generated_credit_card_view_(NULL), |
| 214 open_pdf_in_reader_view_(NULL), | 217 open_pdf_in_reader_view_(NULL), |
| 215 manage_passwords_icon_view_(NULL), | 218 manage_passwords_icon_view_(NULL), |
| 216 translate_icon_view_(NULL), | 219 translate_icon_view_(NULL), |
| 217 star_view_(NULL), | 220 star_view_(NULL), |
| 218 search_button_(NULL), | 221 search_button_(NULL), |
| 219 is_popup_mode_(is_popup_mode), | 222 is_popup_mode_(is_popup_mode), |
| 220 show_focus_rect_(false), | 223 show_focus_rect_(false), |
| 221 template_url_service_(NULL), | 224 template_url_service_(NULL), |
| 222 animation_offset_(0), | 225 animation_offset_(0), |
| 226 animated_host_label_(NULL), | |
| 223 weak_ptr_factory_(this) { | 227 weak_ptr_factory_(this) { |
| 224 edit_bookmarks_enabled_.Init( | 228 edit_bookmarks_enabled_.Init( |
| 225 prefs::kEditBookmarksEnabled, profile->GetPrefs(), | 229 prefs::kEditBookmarksEnabled, profile->GetPrefs(), |
| 226 base::Bind(&LocationBarView::Update, base::Unretained(this), | 230 base::Bind(&LocationBarView::Update, base::Unretained(this), |
| 227 static_cast<content::WebContents*>(NULL))); | 231 static_cast<content::WebContents*>(NULL))); |
| 228 | 232 |
| 229 if (browser_) | 233 if (browser_) |
| 230 browser_->search_model()->AddObserver(this); | 234 browser_->search_model()->AddObserver(this); |
| 231 } | 235 } |
| 232 | 236 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 ime_inline_autocomplete_view_->SetAutoColorReadabilityEnabled(false); | 314 ime_inline_autocomplete_view_->SetAutoColorReadabilityEnabled(false); |
| 311 ime_inline_autocomplete_view_->set_background( | 315 ime_inline_autocomplete_view_->set_background( |
| 312 views::Background::CreateSolidBackground(GetNativeTheme()->GetSystemColor( | 316 views::Background::CreateSolidBackground(GetNativeTheme()->GetSystemColor( |
| 313 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused))); | 317 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused))); |
| 314 ime_inline_autocomplete_view_->SetEnabledColor( | 318 ime_inline_autocomplete_view_->SetEnabledColor( |
| 315 GetNativeTheme()->GetSystemColor( | 319 GetNativeTheme()->GetSystemColor( |
| 316 ui::NativeTheme::kColorId_TextfieldSelectionColor)); | 320 ui::NativeTheme::kColorId_TextfieldSelectionColor)); |
| 317 ime_inline_autocomplete_view_->SetVisible(false); | 321 ime_inline_autocomplete_view_->SetVisible(false); |
| 318 AddChildView(ime_inline_autocomplete_view_); | 322 AddChildView(ime_inline_autocomplete_view_); |
| 319 | 323 |
| 324 animated_host_label_ = new views::Label(base::string16(), font_list); | |
| 325 animated_host_label_->SetVisible(false); | |
| 326 AddChildView(animated_host_label_); | |
| 327 | |
| 320 origin_chip_view_ = new OriginChipView(this, profile(), font_list); | 328 origin_chip_view_ = new OriginChipView(this, profile(), font_list); |
| 321 origin_chip_view_->Init(); | 329 origin_chip_view_->Init(); |
| 322 origin_chip_view_->SetFocusable(false); | 330 origin_chip_view_->SetFocusable(false); |
| 323 origin_chip_view_->set_drag_controller(this); | 331 origin_chip_view_->set_drag_controller(this); |
| 324 AddChildView(origin_chip_view_); | 332 AddChildView(origin_chip_view_); |
| 325 | 333 |
| 326 const SkColor text_color = GetColor(ToolbarModel::NONE, TEXT); | 334 const SkColor text_color = GetColor(ToolbarModel::NONE, TEXT); |
| 327 selected_keyword_view_ = new SelectedKeywordView( | 335 selected_keyword_view_ = new SelectedKeywordView( |
| 328 bubble_font_list, text_color, background_color, profile()); | 336 bubble_font_list, text_color, background_color, profile()); |
| 329 AddChildView(selected_keyword_view_); | 337 AddChildView(selected_keyword_view_); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 416 search_button_border->SetPainter(true, views::Button::STATE_NORMAL, NULL); | 424 search_button_border->SetPainter(true, views::Button::STATE_NORMAL, NULL); |
| 417 search_button_border->SetPainter(true, views::Button::STATE_HOVERED, NULL); | 425 search_button_border->SetPainter(true, views::Button::STATE_HOVERED, NULL); |
| 418 search_button_border->SetPainter(true, views::Button::STATE_PRESSED, NULL); | 426 search_button_border->SetPainter(true, views::Button::STATE_PRESSED, NULL); |
| 419 search_button_border->SetPainter(true, views::Button::STATE_DISABLED, NULL); | 427 search_button_border->SetPainter(true, views::Button::STATE_DISABLED, NULL); |
| 420 search_button_->SetBorder(search_button_border.PassAs<views::Border>()); | 428 search_button_->SetBorder(search_button_border.PassAs<views::Border>()); |
| 421 const int kSearchButtonWidth = 56; | 429 const int kSearchButtonWidth = 56; |
| 422 search_button_->set_min_size(gfx::Size(kSearchButtonWidth, 0)); | 430 search_button_->set_min_size(gfx::Size(kSearchButtonWidth, 0)); |
| 423 search_button_->SetVisible(false); | 431 search_button_->SetVisible(false); |
| 424 AddChildView(search_button_); | 432 AddChildView(search_button_); |
| 425 | 433 |
| 434 show_url_animation_.reset(new gfx::SlideAnimation(this)); | |
| 435 show_url_animation_->SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN); | |
| 436 show_url_animation_->SetSlideDuration(200); | |
| 437 | |
| 438 hide_url_animation_.reset(new gfx::SlideAnimation(this)); | |
| 439 hide_url_animation_->SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN); | |
| 440 hide_url_animation_->SetSlideDuration(200); | |
| 441 | |
| 426 content::Source<Profile> profile_source = content::Source<Profile>(profile()); | 442 content::Source<Profile> profile_source = content::Source<Profile>(profile()); |
| 427 registrar_.Add(this, | 443 registrar_.Add(this, |
| 428 chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, | 444 chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, |
| 429 profile_source); | 445 profile_source); |
| 430 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, profile_source); | 446 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, profile_source); |
| 431 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, profile_source); | 447 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, profile_source); |
| 432 | 448 |
| 433 // Initialize the location entry. We do this to avoid a black flash which is | 449 // Initialize the location entry. We do this to avoid a black flash which is |
| 434 // visible when the location entry has just been initialized. | 450 // visible when the location entry has just been initialized. |
| 435 Update(NULL); | 451 Update(NULL); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 699 min_size.set_width(origin_chip_view_min_size.width() + | 715 min_size.set_width(origin_chip_view_min_size.width() + |
| 700 background_min_size.width() + | 716 background_min_size.width() + |
| 701 search_button_min_size.width()); | 717 search_button_min_size.width()); |
| 702 return min_size; | 718 return min_size; |
| 703 } | 719 } |
| 704 | 720 |
| 705 void LocationBarView::Layout() { | 721 void LocationBarView::Layout() { |
| 706 if (!IsInitialized()) | 722 if (!IsInitialized()) |
| 707 return; | 723 return; |
| 708 | 724 |
| 725 animated_host_label_->SetVisible(false); | |
| 709 origin_chip_view_->SetVisible(origin_chip_view_->ShouldShow()); | 726 origin_chip_view_->SetVisible(origin_chip_view_->ShouldShow()); |
| 710 selected_keyword_view_->SetVisible(false); | 727 selected_keyword_view_->SetVisible(false); |
| 711 location_icon_view_->SetVisible(false); | 728 location_icon_view_->SetVisible(false); |
| 712 ev_bubble_view_->SetVisible(false); | 729 ev_bubble_view_->SetVisible(false); |
| 713 keyword_hint_view_->SetVisible(false); | 730 keyword_hint_view_->SetVisible(false); |
| 714 | 731 |
| 715 const int item_padding = GetItemPadding(); | 732 const int item_padding = GetItemPadding(); |
| 716 | 733 |
| 717 // The textfield has 1 px of whitespace before the text in the RTL case only. | 734 // The textfield has 1 px of whitespace before the text in the RTL case only. |
| 718 const int kEditLeadingInternalSpace = base::i18n::IsRTL() ? 1 : 0; | 735 const int kEditLeadingInternalSpace = base::i18n::IsRTL() ? 1 : 0; |
| 719 LocationBarLayout leading_decorations( | 736 LocationBarLayout leading_decorations( |
| 720 LocationBarLayout::LEFT_EDGE, item_padding - kEditLeadingInternalSpace); | 737 LocationBarLayout::LEFT_EDGE, item_padding - kEditLeadingInternalSpace); |
| 721 LocationBarLayout trailing_decorations(LocationBarLayout::RIGHT_EDGE, | 738 LocationBarLayout trailing_decorations(LocationBarLayout::RIGHT_EDGE, |
| 722 item_padding); | 739 item_padding); |
| 723 | 740 |
| 741 // Show and position the animated host label used in the show and hide URL | |
| 742 // animations. | |
| 743 if (show_url_animation_->is_animating() || | |
| 744 hide_url_animation_->is_animating()) { | |
| 745 const GURL url = GetWebContents()->GetURL(); | |
| 746 const base::string16 host = | |
| 747 OriginChip::LabelFromURLForProfile(url, profile()); | |
| 748 animated_host_label_->SetText(host); | |
| 749 | |
| 750 const base::string16 formatted_url = GetToolbarModel()->GetFormattedURL(); | |
| 751 | |
| 752 // Split the formatted URL on the host name in order to determine the size | |
| 753 // of the text leading up to it. | |
| 754 std::vector<base::string16> substrings; | |
| 755 base::SplitStringUsingSubstr(formatted_url, host, &substrings); | |
|
Peter Kasting
2014/03/21 21:22:10
Does this do the right thing for, say, an intranet
Justin Donnelly
2014/03/24 22:59:37
Good point. There are other issues like a hostname
| |
| 756 const base::string16 text_leading_host = substrings[0]; | |
| 757 | |
| 758 gfx::FontList font_list = origin_chip_view_->GetFontList(); | |
| 759 int w = std::numeric_limits<int>::max(); | |
| 760 int h = font_list.GetHeight(); | |
| 761 gfx::Canvas::SizeStringInt(text_leading_host, font_list, &w, &h, 0, 0); | |
|
Peter Kasting
2014/03/21 21:22:10
Do you just want GetStringWidth() here?
Justin Donnelly
2014/03/24 22:59:37
Oh, cool, didn't see that method. Done.
| |
| 762 | |
| 763 const int position_of_host_name_in_chip = | |
| 764 origin_chip_view_->LabelPosition(); | |
| 765 const int postition_of_host_name_in_url = position_of_host_name_in_chip + w; | |
| 766 | |
| 767 int host_label_x = position_of_host_name_in_chip; | |
| 768 if (show_url_animation_->is_animating()) { | |
| 769 host_label_x = show_url_animation_-> | |
| 770 CurrentValueBetween(position_of_host_name_in_chip, | |
| 771 postition_of_host_name_in_url); | |
| 772 } else if (hide_url_animation_->is_animating()) { | |
| 773 host_label_x = hide_url_animation_-> | |
| 774 CurrentValueBetween(postition_of_host_name_in_url, | |
| 775 position_of_host_name_in_chip); | |
| 776 } | |
| 777 animated_host_label_->SetBounds(host_label_x, 0, | |
| 778 animated_host_label_->GetPreferredSize().width(), height()); | |
|
Peter Kasting
2014/03/21 21:22:10
Nit: All lines of args should begin at the same ho
Justin Donnelly
2014/03/24 22:59:37
Done.
| |
| 779 animated_host_label_->SetVisible(true); | |
| 780 } | |
| 781 | |
| 724 const int origin_chip_width = origin_chip_view_->visible() ? | 782 const int origin_chip_width = origin_chip_view_->visible() ? |
| 725 origin_chip_view_->GetPreferredSize().width() : 0; | 783 origin_chip_view_->GetPreferredSize().width() : 0; |
| 726 origin_chip_view_->SetBounds(0, 0, origin_chip_width, height()); | 784 origin_chip_view_->SetBounds(0, 0, origin_chip_width, height()); |
| 727 | 785 |
| 728 const base::string16 keyword(omnibox_view_->model()->keyword()); | 786 const base::string16 keyword(omnibox_view_->model()->keyword()); |
| 729 const bool is_keyword_hint(omnibox_view_->model()->is_keyword_hint()); | 787 const bool is_keyword_hint(omnibox_view_->model()->is_keyword_hint()); |
| 730 const int bubble_location_y = vertical_edge_thickness() + kBubblePadding; | 788 const int bubble_location_y = vertical_edge_thickness() + kBubblePadding; |
| 731 // In some cases (e.g. fullscreen mode) we may have 0 height. We still want | 789 // In some cases (e.g. fullscreen mode) we may have 0 height. We still want |
| 732 // to position our child views in this case, because other things may be | 790 // to position our child views in this case, because other things may be |
| 733 // positioned relative to them (e.g. the "bookmark added" bubble if the user | 791 // positioned relative to them (e.g. the "bookmark added" bubble if the user |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1092 origin_chip_view_->OnChanged(); | 1150 origin_chip_view_->OnChanged(); |
| 1093 | 1151 |
| 1094 Layout(); | 1152 Layout(); |
| 1095 SchedulePaint(); | 1153 SchedulePaint(); |
| 1096 } | 1154 } |
| 1097 | 1155 |
| 1098 void LocationBarView::OnSetFocus() { | 1156 void LocationBarView::OnSetFocus() { |
| 1099 GetFocusManager()->SetFocusedView(this); | 1157 GetFocusManager()->SetFocusedView(this); |
| 1100 } | 1158 } |
| 1101 | 1159 |
| 1160 void LocationBarView::ShowURL() { | |
| 1161 omnibox_view_->SetVisible(false); | |
| 1162 omnibox_view_->ShowURL(); | |
| 1163 show_url_animation_->Show(); | |
| 1164 } | |
| 1165 | |
| 1166 void LocationBarView::OnShowURLAnimationEnded() { | |
| 1167 animated_host_label_->SetVisible(false); | |
| 1168 omnibox_view_->SetVisible(true); | |
| 1169 omnibox_view_->FadeIn(); | |
| 1170 omnibox_view_->SetFocus(); | |
| 1171 } | |
| 1172 | |
| 1173 void LocationBarView::HideURLAndShowOriginChip() { | |
| 1174 omnibox_view_->SetVisible(false); | |
| 1175 hide_url_animation_->Show(); | |
| 1176 } | |
| 1177 | |
| 1178 void LocationBarView::OnHideURLAnimationEnded() { | |
| 1179 animated_host_label_->SetVisible(false); | |
| 1180 omnibox_view_->HideURL(); | |
| 1181 omnibox_view_->SetVisible(true); | |
| 1182 origin_chip_view_->FadeIn(); | |
| 1183 } | |
| 1184 | |
| 1185 void LocationBarView::AnimationProgressed(const gfx::Animation* animation) { | |
| 1186 if (animation == show_url_animation_.get() || | |
| 1187 animation == hide_url_animation_.get()) { | |
| 1188 Layout(); | |
| 1189 SchedulePaint(); | |
| 1190 } | |
| 1191 } | |
| 1192 | |
| 1193 void LocationBarView::AnimationEnded(const gfx::Animation* animation) { | |
| 1194 if (animation == show_url_animation_.get()) { | |
| 1195 show_url_animation_->Reset(); | |
| 1196 OnShowURLAnimationEnded(); | |
| 1197 } else if (animation == hide_url_animation_.get()) { | |
| 1198 hide_url_animation_->Reset(); | |
| 1199 OnHideURLAnimationEnded(); | |
| 1200 } | |
| 1201 } | |
| 1202 | |
| 1102 InstantController* LocationBarView::GetInstant() { | 1203 InstantController* LocationBarView::GetInstant() { |
| 1103 return delegate_->GetInstant(); | 1204 return delegate_->GetInstant(); |
| 1104 } | 1205 } |
| 1105 | 1206 |
| 1106 WebContents* LocationBarView::GetWebContents() { | 1207 WebContents* LocationBarView::GetWebContents() { |
| 1107 return delegate_->GetWebContents(); | 1208 return delegate_->GetWebContents(); |
| 1108 } | 1209 } |
| 1109 | 1210 |
| 1110 ToolbarModel* LocationBarView::GetToolbarModel() { | 1211 ToolbarModel* LocationBarView::GetToolbarModel() { |
| 1111 return delegate_->GetToolbarModel(); | 1212 return delegate_->GetToolbarModel(); |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1548 if (!browser) | 1649 if (!browser) |
| 1549 return; // Possible when browser is shutting down. | 1650 return; // Possible when browser is shutting down. |
| 1550 | 1651 |
| 1551 FirstRunBubble::ShowBubble(browser, GetLocationBarAnchor()); | 1652 FirstRunBubble::ShowBubble(browser, GetLocationBarAnchor()); |
| 1552 #endif | 1653 #endif |
| 1553 } | 1654 } |
| 1554 | 1655 |
| 1555 void LocationBarView::AccessibilitySetValue(const base::string16& new_value) { | 1656 void LocationBarView::AccessibilitySetValue(const base::string16& new_value) { |
| 1556 omnibox_view_->SetUserText(new_value, new_value, true); | 1657 omnibox_view_->SetUserText(new_value, new_value, true); |
| 1557 } | 1658 } |
| OLD | NEW |