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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 zoom_view_(NULL), | 215 zoom_view_(NULL), |
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 dropdown_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(); | |
322 origin_chip_view_->SetFocusable(false); | 329 origin_chip_view_->SetFocusable(false); |
323 origin_chip_view_->set_drag_controller(this); | 330 origin_chip_view_->set_drag_controller(this); |
324 AddChildView(origin_chip_view_); | 331 AddChildView(origin_chip_view_); |
325 | 332 |
326 const SkColor text_color = GetColor(ToolbarModel::NONE, TEXT); | 333 const SkColor text_color = GetColor(ToolbarModel::NONE, TEXT); |
327 selected_keyword_view_ = new SelectedKeywordView( | 334 selected_keyword_view_ = new SelectedKeywordView( |
328 bubble_font_list, text_color, background_color, profile()); | 335 bubble_font_list, text_color, background_color, profile()); |
329 AddChildView(selected_keyword_view_); | 336 AddChildView(selected_keyword_view_); |
330 | 337 |
331 suggested_text_view_ = new views::Label(base::string16(), font_list); | 338 suggested_text_view_ = new views::Label(base::string16(), font_list); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
416 search_button_border->SetPainter(true, views::Button::STATE_NORMAL, NULL); | 423 search_button_border->SetPainter(true, views::Button::STATE_NORMAL, NULL); |
417 search_button_border->SetPainter(true, views::Button::STATE_HOVERED, NULL); | 424 search_button_border->SetPainter(true, views::Button::STATE_HOVERED, NULL); |
418 search_button_border->SetPainter(true, views::Button::STATE_PRESSED, NULL); | 425 search_button_border->SetPainter(true, views::Button::STATE_PRESSED, NULL); |
419 search_button_border->SetPainter(true, views::Button::STATE_DISABLED, NULL); | 426 search_button_border->SetPainter(true, views::Button::STATE_DISABLED, NULL); |
420 search_button_->SetBorder(search_button_border.PassAs<views::Border>()); | 427 search_button_->SetBorder(search_button_border.PassAs<views::Border>()); |
421 const int kSearchButtonWidth = 56; | 428 const int kSearchButtonWidth = 56; |
422 search_button_->set_min_size(gfx::Size(kSearchButtonWidth, 0)); | 429 search_button_->set_min_size(gfx::Size(kSearchButtonWidth, 0)); |
423 search_button_->SetVisible(false); | 430 search_button_->SetVisible(false); |
424 AddChildView(search_button_); | 431 AddChildView(search_button_); |
425 | 432 |
433 show_url_animation_.reset(new gfx::SlideAnimation(this)); | |
434 show_url_animation_->SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN); | |
435 show_url_animation_->SetSlideDuration(200); | |
436 | |
437 hide_url_animation_.reset(new gfx::SlideAnimation(this)); | |
438 hide_url_animation_->SetTweenType(gfx::Tween::FAST_OUT_SLOW_IN); | |
439 hide_url_animation_->SetSlideDuration(200); | |
440 | |
426 content::Source<Profile> profile_source = content::Source<Profile>(profile()); | 441 content::Source<Profile> profile_source = content::Source<Profile>(profile()); |
427 registrar_.Add(this, | 442 registrar_.Add(this, |
428 chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, | 443 chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, |
429 profile_source); | 444 profile_source); |
430 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, profile_source); | 445 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, profile_source); |
431 registrar_.Add(this, | 446 registrar_.Add(this, |
432 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 447 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
433 profile_source); | 448 profile_source); |
434 | 449 |
435 // Initialize the location entry. We do this to avoid a black flash which is | 450 // Initialize the location entry. We do this to avoid a black flash which is |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
525 const int kDesktopItemPadding = 3; | 540 const int kDesktopItemPadding = 3; |
526 return kDesktopItemPadding; | 541 return kDesktopItemPadding; |
527 } | 542 } |
528 | 543 |
529 // DropdownBarHostDelegate | 544 // DropdownBarHostDelegate |
530 void LocationBarView::SetFocusAndSelection(bool select_all) { | 545 void LocationBarView::SetFocusAndSelection(bool select_all) { |
531 FocusLocation(select_all); | 546 FocusLocation(select_all); |
532 } | 547 } |
533 | 548 |
534 void LocationBarView::SetAnimationOffset(int offset) { | 549 void LocationBarView::SetAnimationOffset(int offset) { |
535 animation_offset_ = offset; | 550 dropdown_animation_offset_ = offset; |
536 } | 551 } |
537 | 552 |
538 void LocationBarView::UpdateContentSettingsIcons() { | 553 void LocationBarView::UpdateContentSettingsIcons() { |
539 if (RefreshContentSettingViews()) { | 554 if (RefreshContentSettingViews()) { |
540 Layout(); | 555 Layout(); |
541 SchedulePaint(); | 556 SchedulePaint(); |
542 } | 557 } |
543 } | 558 } |
544 | 559 |
545 void LocationBarView::UpdateManagePasswordsIconAndBubble() { | 560 void LocationBarView::UpdateManagePasswordsIconAndBubble() { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
701 min_size.set_width(origin_chip_view_min_size.width() + | 716 min_size.set_width(origin_chip_view_min_size.width() + |
702 background_min_size.width() + | 717 background_min_size.width() + |
703 search_button_min_size.width()); | 718 search_button_min_size.width()); |
704 return min_size; | 719 return min_size; |
705 } | 720 } |
706 | 721 |
707 void LocationBarView::Layout() { | 722 void LocationBarView::Layout() { |
708 if (!IsInitialized()) | 723 if (!IsInitialized()) |
709 return; | 724 return; |
710 | 725 |
726 animated_host_label_->SetVisible(false); | |
711 origin_chip_view_->SetVisible(origin_chip_view_->ShouldShow()); | 727 origin_chip_view_->SetVisible(origin_chip_view_->ShouldShow()); |
712 selected_keyword_view_->SetVisible(false); | 728 selected_keyword_view_->SetVisible(false); |
713 location_icon_view_->SetVisible(false); | 729 location_icon_view_->SetVisible(false); |
714 ev_bubble_view_->SetVisible(false); | 730 ev_bubble_view_->SetVisible(false); |
715 keyword_hint_view_->SetVisible(false); | 731 keyword_hint_view_->SetVisible(false); |
716 | 732 |
717 const int item_padding = GetItemPadding(); | 733 const int item_padding = GetItemPadding(); |
718 | 734 |
719 // The textfield has 1 px of whitespace before the text in the RTL case only. | 735 // The textfield has 1 px of whitespace before the text in the RTL case only. |
720 const int kEditLeadingInternalSpace = base::i18n::IsRTL() ? 1 : 0; | 736 const int kEditLeadingInternalSpace = base::i18n::IsRTL() ? 1 : 0; |
721 LocationBarLayout leading_decorations( | 737 LocationBarLayout leading_decorations( |
722 LocationBarLayout::LEFT_EDGE, item_padding - kEditLeadingInternalSpace); | 738 LocationBarLayout::LEFT_EDGE, item_padding - kEditLeadingInternalSpace); |
723 LocationBarLayout trailing_decorations(LocationBarLayout::RIGHT_EDGE, | 739 LocationBarLayout trailing_decorations(LocationBarLayout::RIGHT_EDGE, |
724 item_padding); | 740 item_padding); |
725 | 741 |
742 // Show and position the animated host label used in the show and hide URL | |
743 // animations. | |
744 if (show_url_animation_->is_animating() || | |
745 hide_url_animation_->is_animating()) { | |
746 const GURL url = GetWebContents()->GetURL(); | |
groby-ooo-7-16
2014/03/28 16:34:30
Curious - why set that on every layout, instead of
Justin Donnelly
2014/04/01 16:57:06
Storing the host value below crossed my mind, but
| |
747 const base::string16 host = | |
748 OriginChip::LabelFromURLForProfile(url, profile()); | |
749 animated_host_label_->SetText(host); | |
750 | |
751 const base::string16 formatted_url = GetToolbarModel()->GetFormattedURL(); | |
752 | |
753 // Split the formatted URL on the host name in order to determine the size | |
754 // of the text leading up to it. | |
755 std::vector<base::string16> substrings; | |
756 base::SplitStringUsingSubstr(formatted_url, host, &substrings); | |
757 const base::string16 text_leading_host = substrings[0]; | |
758 const int leading_text_width = | |
759 gfx::Canvas::GetStringWidth(text_leading_host, | |
760 origin_chip_view_->GetFontList()); | |
761 | |
762 const int position_of_host_name_in_chip = origin_chip_view_->host_label_x(); | |
763 const int position_of_host_name_in_url = | |
764 position_of_host_name_in_chip + leading_text_width; | |
765 | |
766 int host_label_x = position_of_host_name_in_chip; | |
767 if (show_url_animation_->is_animating()) { | |
768 host_label_x = show_url_animation_-> | |
769 CurrentValueBetween(position_of_host_name_in_chip, | |
770 position_of_host_name_in_url); | |
771 } else if (hide_url_animation_->is_animating()) { | |
772 host_label_x = hide_url_animation_-> | |
773 CurrentValueBetween(position_of_host_name_in_url, | |
774 position_of_host_name_in_chip); | |
775 } | |
776 animated_host_label_->SetBounds( | |
777 host_label_x, 0, | |
778 animated_host_label_->GetPreferredSize().width(), height()); | |
779 animated_host_label_->SetVisible(true); | |
780 } | |
781 | |
726 const int origin_chip_width = origin_chip_view_->visible() ? | 782 const int origin_chip_width = origin_chip_view_->visible() ? |
727 origin_chip_view_->GetPreferredSize().width() : 0; | 783 origin_chip_view_->GetPreferredSize().width() : 0; |
728 origin_chip_view_->SetBounds(0, 0, origin_chip_width, height()); | 784 origin_chip_view_->SetBounds(0, 0, origin_chip_width, height()); |
729 | 785 |
730 const base::string16 keyword(omnibox_view_->model()->keyword()); | 786 const base::string16 keyword(omnibox_view_->model()->keyword()); |
731 const bool is_keyword_hint(omnibox_view_->model()->is_keyword_hint()); | 787 const bool is_keyword_hint(omnibox_view_->model()->is_keyword_hint()); |
732 const int bubble_location_y = vertical_edge_thickness() + kBubblePadding; | 788 const int bubble_location_y = vertical_edge_thickness() + kBubblePadding; |
733 // 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 |
734 // 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 |
735 // 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... | |
1094 origin_chip_view_->OnChanged(); | 1150 origin_chip_view_->OnChanged(); |
1095 | 1151 |
1096 Layout(); | 1152 Layout(); |
1097 SchedulePaint(); | 1153 SchedulePaint(); |
1098 } | 1154 } |
1099 | 1155 |
1100 void LocationBarView::OnSetFocus() { | 1156 void LocationBarView::OnSetFocus() { |
1101 GetFocusManager()->SetFocusedView(this); | 1157 GetFocusManager()->SetFocusedView(this); |
1102 } | 1158 } |
1103 | 1159 |
1160 void LocationBarView::ShowURL() { | |
1161 if (chrome::ShouldDisplayOriginChipV2()) { | |
1162 omnibox_view_->SetVisible(false); | |
1163 omnibox_view_->ShowURL(); | |
1164 show_url_animation_->Show(); | |
1165 } else { | |
1166 omnibox_view_->ShowURL(); | |
1167 } | |
1168 } | |
1169 | |
1170 void LocationBarView::OnShowURLAnimationEnded() { | |
1171 animated_host_label_->SetVisible(false); | |
1172 omnibox_view_->SetVisible(true); | |
1173 omnibox_view_->FadeIn(); | |
1174 omnibox_view_->SetFocus(); | |
1175 | |
1176 // Sometimes the selection established by OmniboxView::ShowURL() is lost at | |
1177 // the call to SetFocus() above. Select all again to be sure. | |
1178 // TODO(jdonnelly): Figure out why the selection is sometimes lost and | |
1179 // implement a more principled fix. | |
1180 omnibox_view_->SelectAll(true); | |
1181 } | |
1182 | |
1183 void LocationBarView::HideURL() { | |
1184 omnibox_view_->SetVisible(false); | |
1185 hide_url_animation_->Show(); | |
1186 } | |
1187 | |
1188 void LocationBarView::OnHideURLAnimationEnded() { | |
1189 animated_host_label_->SetVisible(false); | |
1190 omnibox_view_->HideURL(); | |
1191 omnibox_view_->SetVisible(true); | |
1192 origin_chip_view_->FadeIn(); | |
1193 } | |
1194 | |
1195 void LocationBarView::AnimationProgressed(const gfx::Animation* animation) { | |
1196 if (animation == show_url_animation_.get() || | |
1197 animation == hide_url_animation_.get()) { | |
1198 Layout(); | |
1199 SchedulePaint(); | |
1200 } | |
1201 } | |
1202 | |
1203 void LocationBarView::AnimationEnded(const gfx::Animation* animation) { | |
1204 if (animation == show_url_animation_.get()) { | |
1205 show_url_animation_->Reset(); | |
1206 OnShowURLAnimationEnded(); | |
1207 } else if (animation == hide_url_animation_.get()) { | |
1208 hide_url_animation_->Reset(); | |
1209 OnHideURLAnimationEnded(); | |
1210 } | |
1211 } | |
1212 | |
1104 InstantController* LocationBarView::GetInstant() { | 1213 InstantController* LocationBarView::GetInstant() { |
1105 return delegate_->GetInstant(); | 1214 return delegate_->GetInstant(); |
1106 } | 1215 } |
1107 | 1216 |
1108 WebContents* LocationBarView::GetWebContents() { | 1217 WebContents* LocationBarView::GetWebContents() { |
1109 return delegate_->GetWebContents(); | 1218 return delegate_->GetWebContents(); |
1110 } | 1219 } |
1111 | 1220 |
1112 ToolbarModel* LocationBarView::GetToolbarModel() { | 1221 ToolbarModel* LocationBarView::GetToolbarModel() { |
1113 return delegate_->GetToolbarModel(); | 1222 return delegate_->GetToolbarModel(); |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1550 if (!browser) | 1659 if (!browser) |
1551 return; // Possible when browser is shutting down. | 1660 return; // Possible when browser is shutting down. |
1552 | 1661 |
1553 FirstRunBubble::ShowBubble(browser, GetLocationBarAnchor()); | 1662 FirstRunBubble::ShowBubble(browser, GetLocationBarAnchor()); |
1554 #endif | 1663 #endif |
1555 } | 1664 } |
1556 | 1665 |
1557 void LocationBarView::AccessibilitySetValue(const base::string16& new_value) { | 1666 void LocationBarView::AccessibilitySetValue(const base::string16& new_value) { |
1558 omnibox_view_->SetUserText(new_value, new_value, true); | 1667 omnibox_view_->SetUserText(new_value, new_value, true); |
1559 } | 1668 } |
OLD | NEW |