| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, bubble_font_list, | 268 profile(), font_list, bubble_font_list, |
| 278 bubble_height + 2 * kBubbleInteriorVerticalPadding, | 269 bubble_height + 2 * kBubbleInteriorVerticalPadding, |
| 279 GetColor(SecurityStateModel::NONE, LocationBarView::DEEMPHASIZED_TEXT), | 270 GetColor(SecurityStateModel::NONE, LocationBarView::DEEMPHASIZED_TEXT), |
| 280 background_color); | 271 background_color); |
| 281 AddChildView(keyword_hint_view_); | 272 AddChildView(keyword_hint_view_); |
| 282 | 273 |
| 283 mic_search_view_ = new views::ImageButton(this); | |
| 284 mic_search_view_->set_id(VIEW_ID_MIC_SEARCH_BUTTON); | |
| 285 mic_search_view_->SetAccessibilityFocusable(true); | |
| 286 mic_search_view_->SetTooltipText( | |
| 287 l10n_util::GetStringUTF16(IDS_TOOLTIP_MIC_SEARCH)); | |
| 288 mic_search_view_->SetImage( | |
| 289 views::Button::STATE_NORMAL, | |
| 290 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | |
| 291 IDR_OMNIBOX_MIC_SEARCH)); | |
| 292 mic_search_view_->SetImageAlignment(views::ImageButton::ALIGN_CENTER, | |
| 293 views::ImageButton::ALIGN_MIDDLE); | |
| 294 mic_search_view_->SetVisible(false); | |
| 295 AddChildView(mic_search_view_); | |
| 296 | |
| 297 const SkColor text_color = GetColor(SecurityStateModel::NONE, TEXT); | 274 const SkColor text_color = GetColor(SecurityStateModel::NONE, TEXT); |
| 298 ScopedVector<ContentSettingImageModel> models = | 275 ScopedVector<ContentSettingImageModel> models = |
| 299 ContentSettingImageModel::GenerateContentSettingImageModels(); | 276 ContentSettingImageModel::GenerateContentSettingImageModels(); |
| 300 for (ContentSettingImageModel* model : models.get()) { | 277 for (ContentSettingImageModel* model : models.get()) { |
| 301 // ContentSettingImageView takes ownership of its model. | 278 // ContentSettingImageView takes ownership of its model. |
| 302 ContentSettingImageView* image_view = new ContentSettingImageView( | 279 ContentSettingImageView* image_view = new ContentSettingImageView( |
| 303 model, this, bubble_font_list, text_color, background_color); | 280 model, this, bubble_font_list, text_color, background_color); |
| 304 content_setting_views_.push_back(image_view); | 281 content_setting_views_.push_back(image_view); |
| 305 image_view->SetVisible(false); | 282 image_view->SetVisible(false); |
| 306 AddChildView(image_view); | 283 AddChildView(image_view); |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 leading_width += GetLayoutConstant(LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING) + | 552 leading_width += GetLayoutConstant(LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING) + |
| 576 ev_bubble_view_->GetMinimumSizeForLabelText( | 553 ev_bubble_view_->GetMinimumSizeForLabelText( |
| 577 GetToolbarModel()->GetEVCertName()).width(); | 554 GetToolbarModel()->GetEVCertName()).width(); |
| 578 } else { | 555 } else { |
| 579 leading_width += padding + location_icon_view_->GetMinimumSize().width(); | 556 leading_width += padding + location_icon_view_->GetMinimumSize().width(); |
| 580 } | 557 } |
| 581 | 558 |
| 582 // Compute width of omnibox-trailing content. | 559 // Compute width of omnibox-trailing content. |
| 583 int trailing_width = horizontal_edge_thickness; | 560 int trailing_width = horizontal_edge_thickness; |
| 584 trailing_width += IncrementalMinimumWidth(star_view_) + | 561 trailing_width += IncrementalMinimumWidth(star_view_) + |
| 585 IncrementalMinimumWidth(translate_icon_view_) + | 562 IncrementalMinimumWidth(translate_icon_view_) + |
| 586 IncrementalMinimumWidth(open_pdf_in_reader_view_) + | 563 IncrementalMinimumWidth(open_pdf_in_reader_view_) + |
| 587 IncrementalMinimumWidth(save_credit_card_icon_view_) + | 564 IncrementalMinimumWidth(save_credit_card_icon_view_) + |
| 588 IncrementalMinimumWidth(manage_passwords_icon_view_) + | 565 IncrementalMinimumWidth(manage_passwords_icon_view_) + |
| 589 IncrementalMinimumWidth(zoom_view_) + | 566 IncrementalMinimumWidth(zoom_view_); |
| 590 IncrementalMinimumWidth(mic_search_view_); | |
| 591 for (PageActionViews::const_iterator i(page_action_views_.begin()); | 567 for (PageActionViews::const_iterator i(page_action_views_.begin()); |
| 592 i != page_action_views_.end(); ++i) | 568 i != page_action_views_.end(); ++i) |
| 593 trailing_width += IncrementalMinimumWidth((*i)); | 569 trailing_width += IncrementalMinimumWidth((*i)); |
| 594 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); | 570 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); |
| 595 i != content_setting_views_.end(); ++i) | 571 i != content_setting_views_.end(); ++i) |
| 596 trailing_width += IncrementalMinimumWidth((*i)); | 572 trailing_width += IncrementalMinimumWidth((*i)); |
| 597 | 573 |
| 598 min_size.set_width(leading_width + omnibox_view_->GetMinimumSize().width() + | 574 min_size.set_width(leading_width + omnibox_view_->GetMinimumSize().width() + |
| 599 2 * padding - omnibox_view_->GetInsets().width() + | 575 2 * padding - omnibox_view_->GetInsets().width() + |
| 600 trailing_width); | 576 trailing_width); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 } | 679 } |
| 704 for (ContentSettingViews::const_reverse_iterator i( | 680 for (ContentSettingViews::const_reverse_iterator i( |
| 705 content_setting_views_.rbegin()); i != content_setting_views_.rend(); | 681 content_setting_views_.rbegin()); i != content_setting_views_.rend(); |
| 706 ++i) { | 682 ++i) { |
| 707 if ((*i)->visible()) { | 683 if ((*i)->visible()) { |
| 708 trailing_decorations.AddDecoration(bubble_vertical_padding, bubble_height, | 684 trailing_decorations.AddDecoration(bubble_vertical_padding, bubble_height, |
| 709 false, 0, item_padding, item_padding, | 685 false, 0, item_padding, item_padding, |
| 710 *i); | 686 *i); |
| 711 } | 687 } |
| 712 } | 688 } |
| 713 if (mic_search_view_->visible()) { | |
| 714 trailing_decorations.AddDecoration(vertical_padding, location_height, | |
| 715 mic_search_view_); | |
| 716 } | |
| 717 // Because IMEs may eat the tab key, we don't show "press tab to search" while | 689 // Because IMEs may eat the tab key, we don't show "press tab to search" while |
| 718 // IME composition is in progress. | 690 // IME composition is in progress. |
| 719 if (!keyword.empty() && omnibox_view_->model()->is_keyword_hint() && | 691 if (!keyword.empty() && omnibox_view_->model()->is_keyword_hint() && |
| 720 !omnibox_view_->IsImeComposing()) { | 692 !omnibox_view_->IsImeComposing()) { |
| 721 trailing_decorations.AddDecoration(vertical_padding, location_height, true, | 693 trailing_decorations.AddDecoration(vertical_padding, location_height, true, |
| 722 0, item_padding, item_padding, | 694 0, item_padding, item_padding, |
| 723 keyword_hint_view_); | 695 keyword_hint_view_); |
| 724 if (keyword_hint_view_->keyword() != keyword) | 696 if (keyword_hint_view_->keyword() != keyword) |
| 725 keyword_hint_view_->SetKeyword(keyword); | 697 keyword_hint_view_->SetKeyword(keyword); |
| 726 } | 698 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 x = entry_width - width; | 789 x = entry_width - width; |
| 818 location_bounds.set_width(x); | 790 location_bounds.set_width(x); |
| 819 ime_inline_autocomplete_view_->SetBounds( | 791 ime_inline_autocomplete_view_->SetBounds( |
| 820 location_bounds.right(), location_bounds.y(), | 792 location_bounds.right(), location_bounds.y(), |
| 821 std::min(width, entry_width), location_bounds.height()); | 793 std::min(width, entry_width), location_bounds.height()); |
| 822 } | 794 } |
| 823 omnibox_view_->SetBoundsRect(location_bounds); | 795 omnibox_view_->SetBoundsRect(location_bounds); |
| 824 } | 796 } |
| 825 | 797 |
| 826 void LocationBarView::Update(const WebContents* contents) { | 798 void LocationBarView::Update(const WebContents* contents) { |
| 827 mic_search_view_->SetVisible( | |
| 828 !GetToolbarModel()->input_in_progress() && browser_ && | |
| 829 browser_->search_model()->voice_search_supported()); | |
| 830 RefreshContentSettingViews(); | 799 RefreshContentSettingViews(); |
| 831 RefreshZoomView(); | 800 RefreshZoomView(); |
| 832 RefreshPageActionViews(); | 801 RefreshPageActionViews(); |
| 833 RefreshTranslateIcon(); | 802 RefreshTranslateIcon(); |
| 834 RefreshSaveCreditCardIconView(); | 803 RefreshSaveCreditCardIconView(); |
| 835 RefreshManagePasswordsIconView(); | 804 RefreshManagePasswordsIconView(); |
| 836 content::WebContents* web_contents_for_sub_views = | 805 content::WebContents* web_contents_for_sub_views = |
| 837 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents(); | 806 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents(); |
| 838 open_pdf_in_reader_view_->Update(web_contents_for_sub_views); | 807 open_pdf_in_reader_view_->Update(web_contents_for_sub_views); |
| 839 | 808 |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1332 // by simply expanding the paint area outside the view by the edge thickness. | 1301 // by simply expanding the paint area outside the view by the edge thickness. |
| 1333 gfx::Rect border_rect(GetContentsBounds()); | 1302 gfx::Rect border_rect(GetContentsBounds()); |
| 1334 if (is_popup_mode_ && (GetHorizontalEdgeThickness() == 0)) | 1303 if (is_popup_mode_ && (GetHorizontalEdgeThickness() == 0)) |
| 1335 border_rect.Inset(-kPopupEdgeThickness, 0); | 1304 border_rect.Inset(-kPopupEdgeThickness, 0); |
| 1336 | 1305 |
| 1337 views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(), | 1306 views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(), |
| 1338 border_rect); | 1307 border_rect); |
| 1339 } | 1308 } |
| 1340 | 1309 |
| 1341 //////////////////////////////////////////////////////////////////////////////// | 1310 //////////////////////////////////////////////////////////////////////////////// |
| 1342 // LocationBarView, private views::ButtonListener implementation: | |
| 1343 | |
| 1344 void LocationBarView::ButtonPressed(views::Button* sender, | |
| 1345 const ui::Event& event) { | |
| 1346 DCHECK_EQ(mic_search_view_, sender); | |
| 1347 command_updater()->ExecuteCommand(IDC_TOGGLE_SPEECH_INPUT); | |
| 1348 } | |
| 1349 | |
| 1350 //////////////////////////////////////////////////////////////////////////////// | |
| 1351 // LocationBarView, private views::DragController implementation: | 1311 // LocationBarView, private views::DragController implementation: |
| 1352 | 1312 |
| 1353 void LocationBarView::WriteDragDataForView(views::View* sender, | 1313 void LocationBarView::WriteDragDataForView(views::View* sender, |
| 1354 const gfx::Point& press_pt, | 1314 const gfx::Point& press_pt, |
| 1355 OSExchangeData* data) { | 1315 OSExchangeData* data) { |
| 1356 DCHECK_NE(GetDragOperationsForView(sender, press_pt), | 1316 DCHECK_NE(GetDragOperationsForView(sender, press_pt), |
| 1357 ui::DragDropTypes::DRAG_NONE); | 1317 ui::DragDropTypes::DRAG_NONE); |
| 1358 | 1318 |
| 1359 WebContents* web_contents = GetWebContents(); | 1319 WebContents* web_contents = GetWebContents(); |
| 1360 favicon::FaviconDriver* favicon_driver = | 1320 favicon::FaviconDriver* favicon_driver = |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1429 // LocationBarView, private TemplateURLServiceObserver implementation: | 1389 // LocationBarView, private TemplateURLServiceObserver implementation: |
| 1430 | 1390 |
| 1431 void LocationBarView::OnTemplateURLServiceChanged() { | 1391 void LocationBarView::OnTemplateURLServiceChanged() { |
| 1432 template_url_service_->RemoveObserver(this); | 1392 template_url_service_->RemoveObserver(this); |
| 1433 template_url_service_ = NULL; | 1393 template_url_service_ = NULL; |
| 1434 // If the browser is no longer active, let's not show the info bubble, as this | 1394 // If the browser is no longer active, let's not show the info bubble, as this |
| 1435 // would make the browser the active window again. | 1395 // would make the browser the active window again. |
| 1436 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1396 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
| 1437 ShowFirstRunBubble(); | 1397 ShowFirstRunBubble(); |
| 1438 } | 1398 } |
| 1439 | |
| 1440 //////////////////////////////////////////////////////////////////////////////// | |
| 1441 // LocationBarView, private SearchModelObserver implementation: | |
| 1442 | |
| 1443 void LocationBarView::ModelChanged(const SearchModel::State& old_state, | |
| 1444 const SearchModel::State& new_state) { | |
| 1445 const bool visible = !GetToolbarModel()->input_in_progress() && | |
| 1446 new_state.voice_search_supported; | |
| 1447 if (mic_search_view_->visible() != visible) { | |
| 1448 mic_search_view_->SetVisible(visible); | |
| 1449 Layout(); | |
| 1450 } | |
| 1451 } | |
| OLD | NEW |