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/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "chrome/browser/translate/chrome_translate_client.h" | 28 #include "chrome/browser/translate/chrome_translate_client.h" |
29 #include "chrome/browser/translate/translate_service.h" | 29 #include "chrome/browser/translate/translate_service.h" |
30 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" | 30 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" |
31 #include "chrome/browser/ui/browser.h" | 31 #include "chrome/browser/ui/browser.h" |
32 #include "chrome/browser/ui/browser_finder.h" | 32 #include "chrome/browser/ui/browser_finder.h" |
33 #include "chrome/browser/ui/browser_instant_controller.h" | 33 #include "chrome/browser/ui/browser_instant_controller.h" |
34 #include "chrome/browser/ui/browser_window.h" | 34 #include "chrome/browser/ui/browser_window.h" |
35 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 35 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
36 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" | 36 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
37 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 37 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
38 #include "chrome/browser/ui/view_ids.h" | |
39 #include "chrome/browser/ui/views/autofill/save_card_icon_view.h" | 38 #include "chrome/browser/ui/views/autofill/save_card_icon_view.h" |
40 #include "chrome/browser/ui/views/browser_dialogs.h" | 39 #include "chrome/browser/ui/views/browser_dialogs.h" |
41 #include "chrome/browser/ui/views/layout_constants.h" | 40 #include "chrome/browser/ui/views/layout_constants.h" |
42 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h" | 41 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h" |
43 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" | 42 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" |
44 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" | 43 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" |
45 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" | 44 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" |
46 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h" | 45 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h" |
47 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 46 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
48 #include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h" | 47 #include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h" |
(...skipping 18 matching lines...) Expand all Loading... |
67 #include "components/ui/zoom/zoom_controller.h" | 66 #include "components/ui/zoom/zoom_controller.h" |
68 #include "components/ui/zoom/zoom_event_manager.h" | 67 #include "components/ui/zoom/zoom_event_manager.h" |
69 #include "content/public/browser/render_widget_host_view.h" | 68 #include "content/public/browser/render_widget_host_view.h" |
70 #include "content/public/browser/web_contents.h" | 69 #include "content/public/browser/web_contents.h" |
71 #include "extensions/browser/extension_registry.h" | 70 #include "extensions/browser/extension_registry.h" |
72 #include "extensions/common/feature_switch.h" | 71 #include "extensions/common/feature_switch.h" |
73 #include "grit/components_scaled_resources.h" | 72 #include "grit/components_scaled_resources.h" |
74 #include "grit/theme_resources.h" | 73 #include "grit/theme_resources.h" |
75 #include "ui/accessibility/ax_view_state.h" | 74 #include "ui/accessibility/ax_view_state.h" |
76 #include "ui/base/dragdrop/drag_drop_types.h" | 75 #include "ui/base/dragdrop/drag_drop_types.h" |
77 #include "ui/base/l10n/l10n_util.h" | |
78 #include "ui/base/resource/material_design/material_design_controller.h" | 76 #include "ui/base/resource/material_design/material_design_controller.h" |
79 #include "ui/base/resource/resource_bundle.h" | 77 #include "ui/base/resource/resource_bundle.h" |
80 #include "ui/base/theme_provider.h" | 78 #include "ui/base/theme_provider.h" |
81 #include "ui/compositor/paint_recorder.h" | 79 #include "ui/compositor/paint_recorder.h" |
82 #include "ui/events/event.h" | 80 #include "ui/events/event.h" |
83 #include "ui/gfx/animation/slide_animation.h" | 81 #include "ui/gfx/animation/slide_animation.h" |
84 #include "ui/gfx/canvas.h" | 82 #include "ui/gfx/canvas.h" |
85 #include "ui/gfx/color_palette.h" | 83 #include "ui/gfx/color_palette.h" |
86 #include "ui/gfx/color_utils.h" | 84 #include "ui/gfx/color_utils.h" |
87 #include "ui/gfx/image/image.h" | 85 #include "ui/gfx/image/image.h" |
88 #include "ui/gfx/image/image_skia_operations.h" | 86 #include "ui/gfx/image/image_skia_operations.h" |
89 #include "ui/gfx/scoped_canvas.h" | 87 #include "ui/gfx/scoped_canvas.h" |
90 #include "ui/gfx/skia_util.h" | 88 #include "ui/gfx/skia_util.h" |
91 #include "ui/gfx/text_utils.h" | 89 #include "ui/gfx/text_utils.h" |
92 #include "ui/native_theme/native_theme.h" | 90 #include "ui/native_theme/native_theme.h" |
93 #include "ui/views/background.h" | 91 #include "ui/views/background.h" |
94 #include "ui/views/border.h" | 92 #include "ui/views/border.h" |
95 #include "ui/views/button_drag_utils.h" | 93 #include "ui/views/button_drag_utils.h" |
96 #include "ui/views/controls/button/image_button.h" | |
97 #include "ui/views/controls/label.h" | 94 #include "ui/views/controls/label.h" |
98 #include "ui/views/widget/widget.h" | 95 #include "ui/views/widget/widget.h" |
99 | 96 |
100 #if !defined(OS_CHROMEOS) | 97 #if !defined(OS_CHROMEOS) |
101 #include "chrome/browser/ui/views/first_run_bubble.h" | 98 #include "chrome/browser/ui/views/first_run_bubble.h" |
102 #endif | 99 #endif |
103 | 100 |
104 using content::WebContents; | 101 using content::WebContents; |
105 using views::View; | 102 using views::View; |
106 | 103 |
(...skipping 25 matching lines...) Expand all Loading... |
132 ChromeOmniboxEditController(command_updater), | 129 ChromeOmniboxEditController(command_updater), |
133 browser_(browser), | 130 browser_(browser), |
134 omnibox_view_(NULL), | 131 omnibox_view_(NULL), |
135 delegate_(delegate), | 132 delegate_(delegate), |
136 location_icon_view_(NULL), | 133 location_icon_view_(NULL), |
137 ev_bubble_view_(NULL), | 134 ev_bubble_view_(NULL), |
138 ime_inline_autocomplete_view_(NULL), | 135 ime_inline_autocomplete_view_(NULL), |
139 selected_keyword_view_(NULL), | 136 selected_keyword_view_(NULL), |
140 suggested_text_view_(NULL), | 137 suggested_text_view_(NULL), |
141 keyword_hint_view_(NULL), | 138 keyword_hint_view_(NULL), |
142 mic_search_view_(NULL), | |
143 zoom_view_(NULL), | 139 zoom_view_(NULL), |
144 open_pdf_in_reader_view_(NULL), | 140 open_pdf_in_reader_view_(NULL), |
145 manage_passwords_icon_view_(NULL), | 141 manage_passwords_icon_view_(NULL), |
146 save_credit_card_icon_view_(nullptr), | 142 save_credit_card_icon_view_(nullptr), |
147 translate_icon_view_(NULL), | 143 translate_icon_view_(NULL), |
148 star_view_(NULL), | 144 star_view_(NULL), |
149 size_animation_(this), | 145 size_animation_(this), |
150 is_popup_mode_(is_popup_mode), | 146 is_popup_mode_(is_popup_mode), |
151 show_focus_rect_(false), | 147 show_focus_rect_(false), |
152 template_url_service_(NULL), | 148 template_url_service_(NULL), |
153 dropdown_animation_offset_(0), | 149 dropdown_animation_offset_(0), |
154 web_contents_null_at_last_refresh_(true) { | 150 web_contents_null_at_last_refresh_(true) { |
155 edit_bookmarks_enabled_.Init( | 151 edit_bookmarks_enabled_.Init( |
156 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(), | 152 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(), |
157 base::Bind(&LocationBarView::UpdateWithoutTabRestore, | 153 base::Bind(&LocationBarView::UpdateWithoutTabRestore, |
158 base::Unretained(this))); | 154 base::Unretained(this))); |
159 | 155 |
160 if (browser_) | |
161 browser_->search_model()->AddObserver(this); | |
162 | |
163 ui_zoom::ZoomEventManager::GetForBrowserContext(profile) | 156 ui_zoom::ZoomEventManager::GetForBrowserContext(profile) |
164 ->AddZoomEventManagerObserver(this); | 157 ->AddZoomEventManagerObserver(this); |
165 | 158 |
166 if (ui::MaterialDesignController::IsModeMaterial()) { | 159 if (ui::MaterialDesignController::IsModeMaterial()) { |
167 set_background(new BackgroundWith1PxBorder( | 160 set_background(new BackgroundWith1PxBorder( |
168 GetColor(SecurityStateModel::NONE, BACKGROUND), | 161 GetColor(SecurityStateModel::NONE, BACKGROUND), |
169 SkColorSetARGB(0x4D, 0x00, 0x00, 0x00), is_popup_mode_)); | 162 SkColorSetARGB(0x4D, 0x00, 0x00, 0x00), is_popup_mode_)); |
170 } | 163 } |
171 } | 164 } |
172 | 165 |
173 LocationBarView::~LocationBarView() { | 166 LocationBarView::~LocationBarView() { |
174 if (template_url_service_) | 167 if (template_url_service_) |
175 template_url_service_->RemoveObserver(this); | 168 template_url_service_->RemoveObserver(this); |
176 if (browser_) | |
177 browser_->search_model()->RemoveObserver(this); | |
178 | 169 |
179 ui_zoom::ZoomEventManager::GetForBrowserContext(profile()) | 170 ui_zoom::ZoomEventManager::GetForBrowserContext(profile()) |
180 ->RemoveZoomEventManagerObserver(this); | 171 ->RemoveZoomEventManagerObserver(this); |
181 } | 172 } |
182 | 173 |
183 //////////////////////////////////////////////////////////////////////////////// | 174 //////////////////////////////////////////////////////////////////////////////// |
184 // LocationBarView, public: | 175 // LocationBarView, public: |
185 | 176 |
186 void LocationBarView::Init() { | 177 void LocationBarView::Init() { |
187 // We need to be in a Widget, otherwise GetNativeTheme() may change and we're | 178 // We need to be in a Widget, otherwise GetNativeTheme() may change and we're |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 GetColor(SecurityStateModel::NONE, LocationBarView::DEEMPHASIZED_TEXT)); | 263 GetColor(SecurityStateModel::NONE, LocationBarView::DEEMPHASIZED_TEXT)); |
273 suggested_text_view_->SetVisible(false); | 264 suggested_text_view_->SetVisible(false); |
274 AddChildView(suggested_text_view_); | 265 AddChildView(suggested_text_view_); |
275 | 266 |
276 keyword_hint_view_ = new KeywordHintView( | 267 keyword_hint_view_ = new KeywordHintView( |
277 profile(), font_list, | 268 profile(), font_list, |
278 GetColor(SecurityStateModel::NONE, LocationBarView::DEEMPHASIZED_TEXT), | 269 GetColor(SecurityStateModel::NONE, LocationBarView::DEEMPHASIZED_TEXT), |
279 background_color); | 270 background_color); |
280 AddChildView(keyword_hint_view_); | 271 AddChildView(keyword_hint_view_); |
281 | 272 |
282 mic_search_view_ = new views::ImageButton(this); | |
283 mic_search_view_->set_id(VIEW_ID_MIC_SEARCH_BUTTON); | |
284 mic_search_view_->SetAccessibilityFocusable(true); | |
285 mic_search_view_->SetTooltipText( | |
286 l10n_util::GetStringUTF16(IDS_TOOLTIP_MIC_SEARCH)); | |
287 mic_search_view_->SetImage( | |
288 views::Button::STATE_NORMAL, | |
289 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | |
290 IDR_OMNIBOX_MIC_SEARCH)); | |
291 mic_search_view_->SetImageAlignment(views::ImageButton::ALIGN_CENTER, | |
292 views::ImageButton::ALIGN_MIDDLE); | |
293 mic_search_view_->SetVisible(false); | |
294 AddChildView(mic_search_view_); | |
295 | |
296 const SkColor text_color = GetColor(SecurityStateModel::NONE, TEXT); | 273 const SkColor text_color = GetColor(SecurityStateModel::NONE, TEXT); |
297 for (ContentSettingsType type : | 274 for (ContentSettingsType type : |
298 ContentSettingBubbleModel::GetSupportedBubbleTypes()) { | 275 ContentSettingBubbleModel::GetSupportedBubbleTypes()) { |
299 ContentSettingImageView* content_blocked_view = new ContentSettingImageView( | 276 ContentSettingImageView* content_blocked_view = new ContentSettingImageView( |
300 type, this, bubble_font_list, text_color, background_color); | 277 type, this, bubble_font_list, text_color, background_color); |
301 content_setting_views_.push_back(content_blocked_view); | 278 content_setting_views_.push_back(content_blocked_view); |
302 content_blocked_view->SetVisible(false); | 279 content_blocked_view->SetVisible(false); |
303 AddChildView(content_blocked_view); | 280 AddChildView(content_blocked_view); |
304 } | 281 } |
305 | 282 |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 leading_width += GetLayoutConstant(LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING) + | 548 leading_width += GetLayoutConstant(LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING) + |
572 ev_bubble_view_->GetMinimumSizeForLabelText( | 549 ev_bubble_view_->GetMinimumSizeForLabelText( |
573 GetToolbarModel()->GetEVCertName()).width(); | 550 GetToolbarModel()->GetEVCertName()).width(); |
574 } else { | 551 } else { |
575 leading_width += padding + location_icon_view_->GetMinimumSize().width(); | 552 leading_width += padding + location_icon_view_->GetMinimumSize().width(); |
576 } | 553 } |
577 | 554 |
578 // Compute width of omnibox-trailing content. | 555 // Compute width of omnibox-trailing content. |
579 int trailing_width = horizontal_edge_thickness; | 556 int trailing_width = horizontal_edge_thickness; |
580 trailing_width += IncrementalMinimumWidth(star_view_) + | 557 trailing_width += IncrementalMinimumWidth(star_view_) + |
581 IncrementalMinimumWidth(translate_icon_view_) + | 558 IncrementalMinimumWidth(translate_icon_view_) + |
582 IncrementalMinimumWidth(open_pdf_in_reader_view_) + | 559 IncrementalMinimumWidth(open_pdf_in_reader_view_) + |
583 IncrementalMinimumWidth(save_credit_card_icon_view_) + | 560 IncrementalMinimumWidth(save_credit_card_icon_view_) + |
584 IncrementalMinimumWidth(manage_passwords_icon_view_) + | 561 IncrementalMinimumWidth(manage_passwords_icon_view_) + |
585 IncrementalMinimumWidth(zoom_view_) + | 562 IncrementalMinimumWidth(zoom_view_); |
586 IncrementalMinimumWidth(mic_search_view_); | |
587 for (PageActionViews::const_iterator i(page_action_views_.begin()); | 563 for (PageActionViews::const_iterator i(page_action_views_.begin()); |
588 i != page_action_views_.end(); ++i) | 564 i != page_action_views_.end(); ++i) |
589 trailing_width += IncrementalMinimumWidth((*i)); | 565 trailing_width += IncrementalMinimumWidth((*i)); |
590 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); | 566 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); |
591 i != content_setting_views_.end(); ++i) | 567 i != content_setting_views_.end(); ++i) |
592 trailing_width += IncrementalMinimumWidth((*i)); | 568 trailing_width += IncrementalMinimumWidth((*i)); |
593 | 569 |
594 min_size.set_width(leading_width + omnibox_view_->GetMinimumSize().width() + | 570 min_size.set_width(leading_width + omnibox_view_->GetMinimumSize().width() + |
595 2 * padding - omnibox_view_->GetInsets().width() + | 571 2 * padding - omnibox_view_->GetInsets().width() + |
596 trailing_width); | 572 trailing_width); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 } | 675 } |
700 for (ContentSettingViews::const_reverse_iterator i( | 676 for (ContentSettingViews::const_reverse_iterator i( |
701 content_setting_views_.rbegin()); i != content_setting_views_.rend(); | 677 content_setting_views_.rbegin()); i != content_setting_views_.rend(); |
702 ++i) { | 678 ++i) { |
703 if ((*i)->visible()) { | 679 if ((*i)->visible()) { |
704 trailing_decorations.AddDecoration(bubble_vertical_padding, bubble_height, | 680 trailing_decorations.AddDecoration(bubble_vertical_padding, bubble_height, |
705 false, 0, item_padding, item_padding, | 681 false, 0, item_padding, item_padding, |
706 *i); | 682 *i); |
707 } | 683 } |
708 } | 684 } |
709 if (mic_search_view_->visible()) { | |
710 trailing_decorations.AddDecoration(vertical_padding, location_height, | |
711 mic_search_view_); | |
712 } | |
713 // Because IMEs may eat the tab key, we don't show "press tab to search" while | 685 // Because IMEs may eat the tab key, we don't show "press tab to search" while |
714 // IME composition is in progress. | 686 // IME composition is in progress. |
715 if (!keyword.empty() && omnibox_view_->model()->is_keyword_hint() && | 687 if (!keyword.empty() && omnibox_view_->model()->is_keyword_hint() && |
716 !omnibox_view_->IsImeComposing()) { | 688 !omnibox_view_->IsImeComposing()) { |
717 trailing_decorations.AddDecoration(vertical_padding, location_height, true, | 689 trailing_decorations.AddDecoration(vertical_padding, location_height, true, |
718 0, item_padding, item_padding, | 690 0, item_padding, item_padding, |
719 keyword_hint_view_); | 691 keyword_hint_view_); |
720 if (keyword_hint_view_->keyword() != keyword) | 692 if (keyword_hint_view_->keyword() != keyword) |
721 keyword_hint_view_->SetKeyword(keyword); | 693 keyword_hint_view_->SetKeyword(keyword); |
722 } | 694 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 x = entry_width - width; | 785 x = entry_width - width; |
814 location_bounds.set_width(x); | 786 location_bounds.set_width(x); |
815 ime_inline_autocomplete_view_->SetBounds( | 787 ime_inline_autocomplete_view_->SetBounds( |
816 location_bounds.right(), location_bounds.y(), | 788 location_bounds.right(), location_bounds.y(), |
817 std::min(width, entry_width), location_bounds.height()); | 789 std::min(width, entry_width), location_bounds.height()); |
818 } | 790 } |
819 omnibox_view_->SetBoundsRect(location_bounds); | 791 omnibox_view_->SetBoundsRect(location_bounds); |
820 } | 792 } |
821 | 793 |
822 void LocationBarView::Update(const WebContents* contents) { | 794 void LocationBarView::Update(const WebContents* contents) { |
823 mic_search_view_->SetVisible( | |
824 !GetToolbarModel()->input_in_progress() && browser_ && | |
825 browser_->search_model()->voice_search_supported()); | |
826 RefreshContentSettingViews(); | 795 RefreshContentSettingViews(); |
827 RefreshZoomView(); | 796 RefreshZoomView(); |
828 RefreshPageActionViews(); | 797 RefreshPageActionViews(); |
829 RefreshTranslateIcon(); | 798 RefreshTranslateIcon(); |
830 RefreshSaveCreditCardIconView(); | 799 RefreshSaveCreditCardIconView(); |
831 RefreshManagePasswordsIconView(); | 800 RefreshManagePasswordsIconView(); |
832 content::WebContents* web_contents_for_sub_views = | 801 content::WebContents* web_contents_for_sub_views = |
833 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents(); | 802 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents(); |
834 open_pdf_in_reader_view_->Update(web_contents_for_sub_views); | 803 open_pdf_in_reader_view_->Update(web_contents_for_sub_views); |
835 | 804 |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 // by simply expanding the paint area outside the view by the edge thickness. | 1297 // by simply expanding the paint area outside the view by the edge thickness. |
1329 gfx::Rect border_rect(GetContentsBounds()); | 1298 gfx::Rect border_rect(GetContentsBounds()); |
1330 if (is_popup_mode_ && (GetHorizontalEdgeThickness() == 0)) | 1299 if (is_popup_mode_ && (GetHorizontalEdgeThickness() == 0)) |
1331 border_rect.Inset(-kPopupEdgeThickness, 0); | 1300 border_rect.Inset(-kPopupEdgeThickness, 0); |
1332 | 1301 |
1333 views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(), | 1302 views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(), |
1334 border_rect); | 1303 border_rect); |
1335 } | 1304 } |
1336 | 1305 |
1337 //////////////////////////////////////////////////////////////////////////////// | 1306 //////////////////////////////////////////////////////////////////////////////// |
1338 // LocationBarView, private views::ButtonListener implementation: | |
1339 | |
1340 void LocationBarView::ButtonPressed(views::Button* sender, | |
1341 const ui::Event& event) { | |
1342 DCHECK_EQ(mic_search_view_, sender); | |
1343 command_updater()->ExecuteCommand(IDC_TOGGLE_SPEECH_INPUT); | |
1344 } | |
1345 | |
1346 //////////////////////////////////////////////////////////////////////////////// | |
1347 // LocationBarView, private views::DragController implementation: | 1307 // LocationBarView, private views::DragController implementation: |
1348 | 1308 |
1349 void LocationBarView::WriteDragDataForView(views::View* sender, | 1309 void LocationBarView::WriteDragDataForView(views::View* sender, |
1350 const gfx::Point& press_pt, | 1310 const gfx::Point& press_pt, |
1351 OSExchangeData* data) { | 1311 OSExchangeData* data) { |
1352 DCHECK_NE(GetDragOperationsForView(sender, press_pt), | 1312 DCHECK_NE(GetDragOperationsForView(sender, press_pt), |
1353 ui::DragDropTypes::DRAG_NONE); | 1313 ui::DragDropTypes::DRAG_NONE); |
1354 | 1314 |
1355 WebContents* web_contents = GetWebContents(); | 1315 WebContents* web_contents = GetWebContents(); |
1356 favicon::FaviconDriver* favicon_driver = | 1316 favicon::FaviconDriver* favicon_driver = |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1425 // LocationBarView, private TemplateURLServiceObserver implementation: | 1385 // LocationBarView, private TemplateURLServiceObserver implementation: |
1426 | 1386 |
1427 void LocationBarView::OnTemplateURLServiceChanged() { | 1387 void LocationBarView::OnTemplateURLServiceChanged() { |
1428 template_url_service_->RemoveObserver(this); | 1388 template_url_service_->RemoveObserver(this); |
1429 template_url_service_ = NULL; | 1389 template_url_service_ = NULL; |
1430 // If the browser is no longer active, let's not show the info bubble, as this | 1390 // If the browser is no longer active, let's not show the info bubble, as this |
1431 // would make the browser the active window again. | 1391 // would make the browser the active window again. |
1432 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1392 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
1433 ShowFirstRunBubble(); | 1393 ShowFirstRunBubble(); |
1434 } | 1394 } |
1435 | |
1436 //////////////////////////////////////////////////////////////////////////////// | |
1437 // LocationBarView, private SearchModelObserver implementation: | |
1438 | |
1439 void LocationBarView::ModelChanged(const SearchModel::State& old_state, | |
1440 const SearchModel::State& new_state) { | |
1441 const bool visible = !GetToolbarModel()->input_in_progress() && | |
1442 new_state.voice_search_supported; | |
1443 if (mic_search_view_->visible() != visible) { | |
1444 mic_search_view_->SetVisible(visible); | |
1445 Layout(); | |
1446 } | |
1447 } | |
OLD | NEW |