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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 1436583002: Revert of Remove setVoiceSearchSupported part of EmbeddedSearch SearchBox API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 17 matching lines...) Expand all
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"
38 #include "chrome/browser/ui/views/autofill/save_card_icon_view.h" 39 #include "chrome/browser/ui/views/autofill/save_card_icon_view.h"
39 #include "chrome/browser/ui/views/browser_dialogs.h" 40 #include "chrome/browser/ui/views/browser_dialogs.h"
40 #include "chrome/browser/ui/views/layout_constants.h" 41 #include "chrome/browser/ui/views/layout_constants.h"
41 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h" 42 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h"
42 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" 43 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h"
43 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" 44 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h"
44 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" 45 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h"
45 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h" 46 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h"
46 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" 47 #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
47 #include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h" 48 #include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h"
(...skipping 18 matching lines...) Expand all
66 #include "components/ui/zoom/zoom_controller.h" 67 #include "components/ui/zoom/zoom_controller.h"
67 #include "components/ui/zoom/zoom_event_manager.h" 68 #include "components/ui/zoom/zoom_event_manager.h"
68 #include "content/public/browser/render_widget_host_view.h" 69 #include "content/public/browser/render_widget_host_view.h"
69 #include "content/public/browser/web_contents.h" 70 #include "content/public/browser/web_contents.h"
70 #include "extensions/browser/extension_registry.h" 71 #include "extensions/browser/extension_registry.h"
71 #include "extensions/common/feature_switch.h" 72 #include "extensions/common/feature_switch.h"
72 #include "grit/components_scaled_resources.h" 73 #include "grit/components_scaled_resources.h"
73 #include "grit/theme_resources.h" 74 #include "grit/theme_resources.h"
74 #include "ui/accessibility/ax_view_state.h" 75 #include "ui/accessibility/ax_view_state.h"
75 #include "ui/base/dragdrop/drag_drop_types.h" 76 #include "ui/base/dragdrop/drag_drop_types.h"
77 #include "ui/base/l10n/l10n_util.h"
76 #include "ui/base/resource/material_design/material_design_controller.h" 78 #include "ui/base/resource/material_design/material_design_controller.h"
77 #include "ui/base/resource/resource_bundle.h" 79 #include "ui/base/resource/resource_bundle.h"
78 #include "ui/base/theme_provider.h" 80 #include "ui/base/theme_provider.h"
79 #include "ui/compositor/paint_recorder.h" 81 #include "ui/compositor/paint_recorder.h"
80 #include "ui/events/event.h" 82 #include "ui/events/event.h"
81 #include "ui/gfx/animation/slide_animation.h" 83 #include "ui/gfx/animation/slide_animation.h"
82 #include "ui/gfx/canvas.h" 84 #include "ui/gfx/canvas.h"
83 #include "ui/gfx/color_palette.h" 85 #include "ui/gfx/color_palette.h"
84 #include "ui/gfx/color_utils.h" 86 #include "ui/gfx/color_utils.h"
85 #include "ui/gfx/image/image.h" 87 #include "ui/gfx/image/image.h"
86 #include "ui/gfx/image/image_skia_operations.h" 88 #include "ui/gfx/image/image_skia_operations.h"
87 #include "ui/gfx/scoped_canvas.h" 89 #include "ui/gfx/scoped_canvas.h"
88 #include "ui/gfx/skia_util.h" 90 #include "ui/gfx/skia_util.h"
89 #include "ui/gfx/text_utils.h" 91 #include "ui/gfx/text_utils.h"
90 #include "ui/native_theme/native_theme.h" 92 #include "ui/native_theme/native_theme.h"
91 #include "ui/views/background.h" 93 #include "ui/views/background.h"
92 #include "ui/views/border.h" 94 #include "ui/views/border.h"
93 #include "ui/views/button_drag_utils.h" 95 #include "ui/views/button_drag_utils.h"
96 #include "ui/views/controls/button/image_button.h"
94 #include "ui/views/controls/label.h" 97 #include "ui/views/controls/label.h"
95 #include "ui/views/widget/widget.h" 98 #include "ui/views/widget/widget.h"
96 99
97 #if !defined(OS_CHROMEOS) 100 #if !defined(OS_CHROMEOS)
98 #include "chrome/browser/ui/views/first_run_bubble.h" 101 #include "chrome/browser/ui/views/first_run_bubble.h"
99 #endif 102 #endif
100 103
101 using content::WebContents; 104 using content::WebContents;
102 using views::View; 105 using views::View;
103 106
(...skipping 25 matching lines...) Expand all
129 ChromeOmniboxEditController(command_updater), 132 ChromeOmniboxEditController(command_updater),
130 browser_(browser), 133 browser_(browser),
131 omnibox_view_(NULL), 134 omnibox_view_(NULL),
132 delegate_(delegate), 135 delegate_(delegate),
133 location_icon_view_(NULL), 136 location_icon_view_(NULL),
134 ev_bubble_view_(NULL), 137 ev_bubble_view_(NULL),
135 ime_inline_autocomplete_view_(NULL), 138 ime_inline_autocomplete_view_(NULL),
136 selected_keyword_view_(NULL), 139 selected_keyword_view_(NULL),
137 suggested_text_view_(NULL), 140 suggested_text_view_(NULL),
138 keyword_hint_view_(NULL), 141 keyword_hint_view_(NULL),
142 mic_search_view_(NULL),
139 zoom_view_(NULL), 143 zoom_view_(NULL),
140 open_pdf_in_reader_view_(NULL), 144 open_pdf_in_reader_view_(NULL),
141 manage_passwords_icon_view_(NULL), 145 manage_passwords_icon_view_(NULL),
142 save_credit_card_icon_view_(nullptr), 146 save_credit_card_icon_view_(nullptr),
143 translate_icon_view_(NULL), 147 translate_icon_view_(NULL),
144 star_view_(NULL), 148 star_view_(NULL),
145 size_animation_(this), 149 size_animation_(this),
146 is_popup_mode_(is_popup_mode), 150 is_popup_mode_(is_popup_mode),
147 show_focus_rect_(false), 151 show_focus_rect_(false),
148 template_url_service_(NULL), 152 template_url_service_(NULL),
149 dropdown_animation_offset_(0), 153 dropdown_animation_offset_(0),
150 web_contents_null_at_last_refresh_(true) { 154 web_contents_null_at_last_refresh_(true) {
151 edit_bookmarks_enabled_.Init( 155 edit_bookmarks_enabled_.Init(
152 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(), 156 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(),
153 base::Bind(&LocationBarView::UpdateWithoutTabRestore, 157 base::Bind(&LocationBarView::UpdateWithoutTabRestore,
154 base::Unretained(this))); 158 base::Unretained(this)));
155 159
160 if (browser_)
161 browser_->search_model()->AddObserver(this);
162
156 ui_zoom::ZoomEventManager::GetForBrowserContext(profile) 163 ui_zoom::ZoomEventManager::GetForBrowserContext(profile)
157 ->AddZoomEventManagerObserver(this); 164 ->AddZoomEventManagerObserver(this);
158 165
159 if (ui::MaterialDesignController::IsModeMaterial()) { 166 if (ui::MaterialDesignController::IsModeMaterial()) {
160 set_background(new BackgroundWith1PxBorder( 167 set_background(new BackgroundWith1PxBorder(
161 GetColor(SecurityStateModel::NONE, BACKGROUND), 168 GetColor(SecurityStateModel::NONE, BACKGROUND),
162 SkColorSetARGB(0x4D, 0x00, 0x00, 0x00), is_popup_mode_)); 169 SkColorSetARGB(0x4D, 0x00, 0x00, 0x00), is_popup_mode_));
163 } 170 }
164 } 171 }
165 172
166 LocationBarView::~LocationBarView() { 173 LocationBarView::~LocationBarView() {
167 if (template_url_service_) 174 if (template_url_service_)
168 template_url_service_->RemoveObserver(this); 175 template_url_service_->RemoveObserver(this);
176 if (browser_)
177 browser_->search_model()->RemoveObserver(this);
169 178
170 ui_zoom::ZoomEventManager::GetForBrowserContext(profile()) 179 ui_zoom::ZoomEventManager::GetForBrowserContext(profile())
171 ->RemoveZoomEventManagerObserver(this); 180 ->RemoveZoomEventManagerObserver(this);
172 } 181 }
173 182
174 //////////////////////////////////////////////////////////////////////////////// 183 ////////////////////////////////////////////////////////////////////////////////
175 // LocationBarView, public: 184 // LocationBarView, public:
176 185
177 void LocationBarView::Init() { 186 void LocationBarView::Init() {
178 // We need to be in a Widget, otherwise GetNativeTheme() may change and we're 187 // 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
263 GetColor(SecurityStateModel::NONE, LocationBarView::DEEMPHASIZED_TEXT)); 272 GetColor(SecurityStateModel::NONE, LocationBarView::DEEMPHASIZED_TEXT));
264 suggested_text_view_->SetVisible(false); 273 suggested_text_view_->SetVisible(false);
265 AddChildView(suggested_text_view_); 274 AddChildView(suggested_text_view_);
266 275
267 keyword_hint_view_ = new KeywordHintView( 276 keyword_hint_view_ = new KeywordHintView(
268 profile(), font_list, 277 profile(), font_list,
269 GetColor(SecurityStateModel::NONE, LocationBarView::DEEMPHASIZED_TEXT), 278 GetColor(SecurityStateModel::NONE, LocationBarView::DEEMPHASIZED_TEXT),
270 background_color); 279 background_color);
271 AddChildView(keyword_hint_view_); 280 AddChildView(keyword_hint_view_);
272 281
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
273 const SkColor text_color = GetColor(SecurityStateModel::NONE, TEXT); 296 const SkColor text_color = GetColor(SecurityStateModel::NONE, TEXT);
274 for (ContentSettingsType type : 297 for (ContentSettingsType type :
275 ContentSettingBubbleModel::GetSupportedBubbleTypes()) { 298 ContentSettingBubbleModel::GetSupportedBubbleTypes()) {
276 ContentSettingImageView* content_blocked_view = new ContentSettingImageView( 299 ContentSettingImageView* content_blocked_view = new ContentSettingImageView(
277 type, this, bubble_font_list, text_color, background_color); 300 type, this, bubble_font_list, text_color, background_color);
278 content_setting_views_.push_back(content_blocked_view); 301 content_setting_views_.push_back(content_blocked_view);
279 content_blocked_view->SetVisible(false); 302 content_blocked_view->SetVisible(false);
280 AddChildView(content_blocked_view); 303 AddChildView(content_blocked_view);
281 } 304 }
282 305
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 leading_width += GetLayoutConstant(LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING) + 571 leading_width += GetLayoutConstant(LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING) +
549 ev_bubble_view_->GetMinimumSizeForLabelText( 572 ev_bubble_view_->GetMinimumSizeForLabelText(
550 GetToolbarModel()->GetEVCertName()).width(); 573 GetToolbarModel()->GetEVCertName()).width();
551 } else { 574 } else {
552 leading_width += padding + location_icon_view_->GetMinimumSize().width(); 575 leading_width += padding + location_icon_view_->GetMinimumSize().width();
553 } 576 }
554 577
555 // Compute width of omnibox-trailing content. 578 // Compute width of omnibox-trailing content.
556 int trailing_width = horizontal_edge_thickness; 579 int trailing_width = horizontal_edge_thickness;
557 trailing_width += IncrementalMinimumWidth(star_view_) + 580 trailing_width += IncrementalMinimumWidth(star_view_) +
558 IncrementalMinimumWidth(translate_icon_view_) + 581 IncrementalMinimumWidth(translate_icon_view_) +
559 IncrementalMinimumWidth(open_pdf_in_reader_view_) + 582 IncrementalMinimumWidth(open_pdf_in_reader_view_) +
560 IncrementalMinimumWidth(save_credit_card_icon_view_) + 583 IncrementalMinimumWidth(save_credit_card_icon_view_) +
561 IncrementalMinimumWidth(manage_passwords_icon_view_) + 584 IncrementalMinimumWidth(manage_passwords_icon_view_) +
562 IncrementalMinimumWidth(zoom_view_); 585 IncrementalMinimumWidth(zoom_view_) +
586 IncrementalMinimumWidth(mic_search_view_);
563 for (PageActionViews::const_iterator i(page_action_views_.begin()); 587 for (PageActionViews::const_iterator i(page_action_views_.begin());
564 i != page_action_views_.end(); ++i) 588 i != page_action_views_.end(); ++i)
565 trailing_width += IncrementalMinimumWidth((*i)); 589 trailing_width += IncrementalMinimumWidth((*i));
566 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); 590 for (ContentSettingViews::const_iterator i(content_setting_views_.begin());
567 i != content_setting_views_.end(); ++i) 591 i != content_setting_views_.end(); ++i)
568 trailing_width += IncrementalMinimumWidth((*i)); 592 trailing_width += IncrementalMinimumWidth((*i));
569 593
570 min_size.set_width(leading_width + omnibox_view_->GetMinimumSize().width() + 594 min_size.set_width(leading_width + omnibox_view_->GetMinimumSize().width() +
571 2 * padding - omnibox_view_->GetInsets().width() + 595 2 * padding - omnibox_view_->GetInsets().width() +
572 trailing_width); 596 trailing_width);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 } 699 }
676 for (ContentSettingViews::const_reverse_iterator i( 700 for (ContentSettingViews::const_reverse_iterator i(
677 content_setting_views_.rbegin()); i != content_setting_views_.rend(); 701 content_setting_views_.rbegin()); i != content_setting_views_.rend();
678 ++i) { 702 ++i) {
679 if ((*i)->visible()) { 703 if ((*i)->visible()) {
680 trailing_decorations.AddDecoration(bubble_vertical_padding, bubble_height, 704 trailing_decorations.AddDecoration(bubble_vertical_padding, bubble_height,
681 false, 0, item_padding, item_padding, 705 false, 0, item_padding, item_padding,
682 *i); 706 *i);
683 } 707 }
684 } 708 }
709 if (mic_search_view_->visible()) {
710 trailing_decorations.AddDecoration(vertical_padding, location_height,
711 mic_search_view_);
712 }
685 // Because IMEs may eat the tab key, we don't show "press tab to search" while 713 // Because IMEs may eat the tab key, we don't show "press tab to search" while
686 // IME composition is in progress. 714 // IME composition is in progress.
687 if (!keyword.empty() && omnibox_view_->model()->is_keyword_hint() && 715 if (!keyword.empty() && omnibox_view_->model()->is_keyword_hint() &&
688 !omnibox_view_->IsImeComposing()) { 716 !omnibox_view_->IsImeComposing()) {
689 trailing_decorations.AddDecoration(vertical_padding, location_height, true, 717 trailing_decorations.AddDecoration(vertical_padding, location_height, true,
690 0, item_padding, item_padding, 718 0, item_padding, item_padding,
691 keyword_hint_view_); 719 keyword_hint_view_);
692 if (keyword_hint_view_->keyword() != keyword) 720 if (keyword_hint_view_->keyword() != keyword)
693 keyword_hint_view_->SetKeyword(keyword); 721 keyword_hint_view_->SetKeyword(keyword);
694 } 722 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 x = entry_width - width; 813 x = entry_width - width;
786 location_bounds.set_width(x); 814 location_bounds.set_width(x);
787 ime_inline_autocomplete_view_->SetBounds( 815 ime_inline_autocomplete_view_->SetBounds(
788 location_bounds.right(), location_bounds.y(), 816 location_bounds.right(), location_bounds.y(),
789 std::min(width, entry_width), location_bounds.height()); 817 std::min(width, entry_width), location_bounds.height());
790 } 818 }
791 omnibox_view_->SetBoundsRect(location_bounds); 819 omnibox_view_->SetBoundsRect(location_bounds);
792 } 820 }
793 821
794 void LocationBarView::Update(const WebContents* contents) { 822 void LocationBarView::Update(const WebContents* contents) {
823 mic_search_view_->SetVisible(
824 !GetToolbarModel()->input_in_progress() && browser_ &&
825 browser_->search_model()->voice_search_supported());
795 RefreshContentSettingViews(); 826 RefreshContentSettingViews();
796 RefreshZoomView(); 827 RefreshZoomView();
797 RefreshPageActionViews(); 828 RefreshPageActionViews();
798 RefreshTranslateIcon(); 829 RefreshTranslateIcon();
799 RefreshSaveCreditCardIconView(); 830 RefreshSaveCreditCardIconView();
800 RefreshManagePasswordsIconView(); 831 RefreshManagePasswordsIconView();
801 content::WebContents* web_contents_for_sub_views = 832 content::WebContents* web_contents_for_sub_views =
802 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents(); 833 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents();
803 open_pdf_in_reader_view_->Update(web_contents_for_sub_views); 834 open_pdf_in_reader_view_->Update(web_contents_for_sub_views);
804 835
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 // by simply expanding the paint area outside the view by the edge thickness. 1328 // by simply expanding the paint area outside the view by the edge thickness.
1298 gfx::Rect border_rect(GetContentsBounds()); 1329 gfx::Rect border_rect(GetContentsBounds());
1299 if (is_popup_mode_ && (GetHorizontalEdgeThickness() == 0)) 1330 if (is_popup_mode_ && (GetHorizontalEdgeThickness() == 0))
1300 border_rect.Inset(-kPopupEdgeThickness, 0); 1331 border_rect.Inset(-kPopupEdgeThickness, 0);
1301 1332
1302 views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(), 1333 views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(),
1303 border_rect); 1334 border_rect);
1304 } 1335 }
1305 1336
1306 //////////////////////////////////////////////////////////////////////////////// 1337 ////////////////////////////////////////////////////////////////////////////////
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 ////////////////////////////////////////////////////////////////////////////////
1307 // LocationBarView, private views::DragController implementation: 1347 // LocationBarView, private views::DragController implementation:
1308 1348
1309 void LocationBarView::WriteDragDataForView(views::View* sender, 1349 void LocationBarView::WriteDragDataForView(views::View* sender,
1310 const gfx::Point& press_pt, 1350 const gfx::Point& press_pt,
1311 OSExchangeData* data) { 1351 OSExchangeData* data) {
1312 DCHECK_NE(GetDragOperationsForView(sender, press_pt), 1352 DCHECK_NE(GetDragOperationsForView(sender, press_pt),
1313 ui::DragDropTypes::DRAG_NONE); 1353 ui::DragDropTypes::DRAG_NONE);
1314 1354
1315 WebContents* web_contents = GetWebContents(); 1355 WebContents* web_contents = GetWebContents();
1316 favicon::FaviconDriver* favicon_driver = 1356 favicon::FaviconDriver* favicon_driver =
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 // LocationBarView, private TemplateURLServiceObserver implementation: 1425 // LocationBarView, private TemplateURLServiceObserver implementation:
1386 1426
1387 void LocationBarView::OnTemplateURLServiceChanged() { 1427 void LocationBarView::OnTemplateURLServiceChanged() {
1388 template_url_service_->RemoveObserver(this); 1428 template_url_service_->RemoveObserver(this);
1389 template_url_service_ = NULL; 1429 template_url_service_ = NULL;
1390 // If the browser is no longer active, let's not show the info bubble, as this 1430 // If the browser is no longer active, let's not show the info bubble, as this
1391 // would make the browser the active window again. 1431 // would make the browser the active window again.
1392 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) 1432 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive())
1393 ShowFirstRunBubble(); 1433 ShowFirstRunBubble();
1394 } 1434 }
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | chrome/browser/ui/views/omnibox/omnibox_result_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698