Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/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" | 38 #include "chrome/browser/ui/view_ids.h" |
|
msw
2015/11/06 23:59:23
nit: remove
Evan Stade
2015/11/07 00:43:03
Done.
| |
| 39 #include "chrome/browser/ui/views/autofill/save_card_icon_view.h" | 39 #include "chrome/browser/ui/views/autofill/save_card_icon_view.h" |
| 40 #include "chrome/browser/ui/views/browser_dialogs.h" | 40 #include "chrome/browser/ui/views/browser_dialogs.h" |
| 41 #include "chrome/browser/ui/views/layout_constants.h" | 41 #include "chrome/browser/ui/views/layout_constants.h" |
| 42 #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" |
| 43 #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" |
| 44 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" | 44 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" |
| 45 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" | 45 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" |
| 46 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h" | 46 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h" |
| 47 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 47 #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" | 48 #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" | 67 #include "components/ui/zoom/zoom_controller.h" |
| 68 #include "components/ui/zoom/zoom_event_manager.h" | 68 #include "components/ui/zoom/zoom_event_manager.h" |
| 69 #include "content/public/browser/render_widget_host_view.h" | 69 #include "content/public/browser/render_widget_host_view.h" |
| 70 #include "content/public/browser/web_contents.h" | 70 #include "content/public/browser/web_contents.h" |
| 71 #include "extensions/browser/extension_registry.h" | 71 #include "extensions/browser/extension_registry.h" |
| 72 #include "extensions/common/feature_switch.h" | 72 #include "extensions/common/feature_switch.h" |
| 73 #include "grit/components_scaled_resources.h" | 73 #include "grit/components_scaled_resources.h" |
| 74 #include "grit/theme_resources.h" | 74 #include "grit/theme_resources.h" |
| 75 #include "ui/accessibility/ax_view_state.h" | 75 #include "ui/accessibility/ax_view_state.h" |
| 76 #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" | 77 #include "ui/base/l10n/l10n_util.h" |
|
msw
2015/11/06 23:59:23
nit: remove
Evan Stade
2015/11/07 00:43:03
Done.
| |
| 78 #include "ui/base/resource/material_design/material_design_controller.h" | 78 #include "ui/base/resource/material_design/material_design_controller.h" |
| 79 #include "ui/base/resource/resource_bundle.h" | 79 #include "ui/base/resource/resource_bundle.h" |
| 80 #include "ui/base/theme_provider.h" | 80 #include "ui/base/theme_provider.h" |
| 81 #include "ui/compositor/paint_recorder.h" | 81 #include "ui/compositor/paint_recorder.h" |
| 82 #include "ui/events/event.h" | 82 #include "ui/events/event.h" |
| 83 #include "ui/gfx/animation/slide_animation.h" | 83 #include "ui/gfx/animation/slide_animation.h" |
| 84 #include "ui/gfx/canvas.h" | 84 #include "ui/gfx/canvas.h" |
| 85 #include "ui/gfx/color_utils.h" | 85 #include "ui/gfx/color_utils.h" |
| 86 #include "ui/gfx/image/image.h" | 86 #include "ui/gfx/image/image.h" |
| 87 #include "ui/gfx/image/image_skia_operations.h" | 87 #include "ui/gfx/image/image_skia_operations.h" |
| 88 #include "ui/gfx/scoped_canvas.h" | 88 #include "ui/gfx/scoped_canvas.h" |
| 89 #include "ui/gfx/skia_util.h" | 89 #include "ui/gfx/skia_util.h" |
| 90 #include "ui/gfx/text_utils.h" | 90 #include "ui/gfx/text_utils.h" |
| 91 #include "ui/native_theme/native_theme.h" | 91 #include "ui/native_theme/native_theme.h" |
| 92 #include "ui/views/background.h" | 92 #include "ui/views/background.h" |
| 93 #include "ui/views/border.h" | 93 #include "ui/views/border.h" |
| 94 #include "ui/views/button_drag_utils.h" | 94 #include "ui/views/button_drag_utils.h" |
| 95 #include "ui/views/controls/button/image_button.h" | 95 #include "ui/views/controls/button/image_button.h" |
|
msw
2015/11/06 23:59:23
nit: remove
Evan Stade
2015/11/07 00:43:03
Done.
| |
| 96 #include "ui/views/controls/label.h" | 96 #include "ui/views/controls/label.h" |
| 97 #include "ui/views/widget/widget.h" | 97 #include "ui/views/widget/widget.h" |
| 98 | 98 |
| 99 #if !defined(OS_CHROMEOS) | 99 #if !defined(OS_CHROMEOS) |
| 100 #include "chrome/browser/ui/views/first_run_bubble.h" | 100 #include "chrome/browser/ui/views/first_run_bubble.h" |
| 101 #endif | 101 #endif |
| 102 | 102 |
| 103 using content::WebContents; | 103 using content::WebContents; |
| 104 using views::View; | 104 using views::View; |
| 105 | 105 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 131 ChromeOmniboxEditController(command_updater), | 131 ChromeOmniboxEditController(command_updater), |
| 132 browser_(browser), | 132 browser_(browser), |
| 133 omnibox_view_(NULL), | 133 omnibox_view_(NULL), |
| 134 delegate_(delegate), | 134 delegate_(delegate), |
| 135 location_icon_view_(NULL), | 135 location_icon_view_(NULL), |
| 136 ev_bubble_view_(NULL), | 136 ev_bubble_view_(NULL), |
| 137 ime_inline_autocomplete_view_(NULL), | 137 ime_inline_autocomplete_view_(NULL), |
| 138 selected_keyword_view_(NULL), | 138 selected_keyword_view_(NULL), |
| 139 suggested_text_view_(NULL), | 139 suggested_text_view_(NULL), |
| 140 keyword_hint_view_(NULL), | 140 keyword_hint_view_(NULL), |
| 141 mic_search_view_(NULL), | |
| 142 zoom_view_(NULL), | 141 zoom_view_(NULL), |
| 143 open_pdf_in_reader_view_(NULL), | 142 open_pdf_in_reader_view_(NULL), |
| 144 manage_passwords_icon_view_(NULL), | 143 manage_passwords_icon_view_(NULL), |
| 145 save_credit_card_icon_view_(nullptr), | 144 save_credit_card_icon_view_(nullptr), |
| 146 translate_icon_view_(NULL), | 145 translate_icon_view_(NULL), |
| 147 star_view_(NULL), | 146 star_view_(NULL), |
| 148 size_animation_(this), | 147 size_animation_(this), |
| 149 is_popup_mode_(is_popup_mode), | 148 is_popup_mode_(is_popup_mode), |
| 150 show_focus_rect_(false), | 149 show_focus_rect_(false), |
| 151 template_url_service_(NULL), | 150 template_url_service_(NULL), |
| 152 dropdown_animation_offset_(0), | 151 dropdown_animation_offset_(0), |
| 153 web_contents_null_at_last_refresh_(true) { | 152 web_contents_null_at_last_refresh_(true) { |
| 154 edit_bookmarks_enabled_.Init( | 153 edit_bookmarks_enabled_.Init( |
| 155 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(), | 154 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(), |
| 156 base::Bind(&LocationBarView::UpdateWithoutTabRestore, | 155 base::Bind(&LocationBarView::UpdateWithoutTabRestore, |
| 157 base::Unretained(this))); | 156 base::Unretained(this))); |
| 158 | 157 |
| 159 if (browser_) | |
| 160 browser_->search_model()->AddObserver(this); | |
| 161 | |
| 162 ui_zoom::ZoomEventManager::GetForBrowserContext(profile) | 158 ui_zoom::ZoomEventManager::GetForBrowserContext(profile) |
| 163 ->AddZoomEventManagerObserver(this); | 159 ->AddZoomEventManagerObserver(this); |
| 164 | 160 |
| 165 if (ui::MaterialDesignController::IsModeMaterial()) { | 161 if (ui::MaterialDesignController::IsModeMaterial()) { |
| 166 set_background(new BackgroundWith1PxBorder( | 162 set_background(new BackgroundWith1PxBorder( |
| 167 GetColor(SecurityStateModel::NONE, BACKGROUND), | 163 GetColor(SecurityStateModel::NONE, BACKGROUND), |
| 168 SkColorSetARGB(0x4D, 0x00, 0x00, 0x00), is_popup_mode_)); | 164 SkColorSetARGB(0x4D, 0x00, 0x00, 0x00), is_popup_mode_)); |
| 169 } | 165 } |
| 170 } | 166 } |
| 171 | 167 |
| 172 LocationBarView::~LocationBarView() { | 168 LocationBarView::~LocationBarView() { |
| 173 if (template_url_service_) | 169 if (template_url_service_) |
| 174 template_url_service_->RemoveObserver(this); | 170 template_url_service_->RemoveObserver(this); |
| 175 if (browser_) | |
| 176 browser_->search_model()->RemoveObserver(this); | |
| 177 | 171 |
| 178 ui_zoom::ZoomEventManager::GetForBrowserContext(profile()) | 172 ui_zoom::ZoomEventManager::GetForBrowserContext(profile()) |
| 179 ->RemoveZoomEventManagerObserver(this); | 173 ->RemoveZoomEventManagerObserver(this); |
| 180 } | 174 } |
| 181 | 175 |
| 182 //////////////////////////////////////////////////////////////////////////////// | 176 //////////////////////////////////////////////////////////////////////////////// |
| 183 // LocationBarView, public: | 177 // LocationBarView, public: |
| 184 | 178 |
| 185 void LocationBarView::Init() { | 179 void LocationBarView::Init() { |
| 186 // We need to be in a Widget, otherwise GetNativeTheme() may change and we're | 180 // We need to be in a Widget, otherwise GetNativeTheme() may change and we're |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 GetColor(SecurityStateModel::NONE, LocationBarView::DEEMPHASIZED_TEXT)); | 268 GetColor(SecurityStateModel::NONE, LocationBarView::DEEMPHASIZED_TEXT)); |
| 275 suggested_text_view_->SetVisible(false); | 269 suggested_text_view_->SetVisible(false); |
| 276 AddChildView(suggested_text_view_); | 270 AddChildView(suggested_text_view_); |
| 277 | 271 |
| 278 keyword_hint_view_ = new KeywordHintView( | 272 keyword_hint_view_ = new KeywordHintView( |
| 279 profile(), font_list, | 273 profile(), font_list, |
| 280 GetColor(SecurityStateModel::NONE, LocationBarView::DEEMPHASIZED_TEXT), | 274 GetColor(SecurityStateModel::NONE, LocationBarView::DEEMPHASIZED_TEXT), |
| 281 background_color); | 275 background_color); |
| 282 AddChildView(keyword_hint_view_); | 276 AddChildView(keyword_hint_view_); |
| 283 | 277 |
| 284 mic_search_view_ = new views::ImageButton(this); | |
| 285 mic_search_view_->set_id(VIEW_ID_MIC_SEARCH_BUTTON); | |
| 286 mic_search_view_->SetAccessibilityFocusable(true); | |
| 287 mic_search_view_->SetTooltipText( | |
| 288 l10n_util::GetStringUTF16(IDS_TOOLTIP_MIC_SEARCH)); | |
|
msw
2015/11/06 23:59:23
Remove IDS_TOOLTIP_MIC_SEARCH and other uses?
Evan Stade
2015/11/07 00:43:03
no, this tooltip is used in the cros app list
| |
| 289 mic_search_view_->SetImage( | |
| 290 views::Button::STATE_NORMAL, | |
| 291 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | |
| 292 IDR_OMNIBOX_MIC_SEARCH)); | |
| 293 mic_search_view_->SetImageAlignment(views::ImageButton::ALIGN_CENTER, | |
| 294 views::ImageButton::ALIGN_MIDDLE); | |
| 295 mic_search_view_->SetVisible(false); | |
| 296 AddChildView(mic_search_view_); | |
| 297 | |
| 298 const SkColor text_color = GetColor(SecurityStateModel::NONE, TEXT); | 278 const SkColor text_color = GetColor(SecurityStateModel::NONE, TEXT); |
| 299 for (ContentSettingsType type : | 279 for (ContentSettingsType type : |
| 300 ContentSettingBubbleModel::GetSupportedBubbleTypes()) { | 280 ContentSettingBubbleModel::GetSupportedBubbleTypes()) { |
| 301 ContentSettingImageView* content_blocked_view = new ContentSettingImageView( | 281 ContentSettingImageView* content_blocked_view = new ContentSettingImageView( |
| 302 type, this, bubble_font_list, text_color, background_color); | 282 type, this, bubble_font_list, text_color, background_color); |
| 303 content_setting_views_.push_back(content_blocked_view); | 283 content_setting_views_.push_back(content_blocked_view); |
| 304 content_blocked_view->SetVisible(false); | 284 content_blocked_view->SetVisible(false); |
| 305 AddChildView(content_blocked_view); | 285 AddChildView(content_blocked_view); |
| 306 } | 286 } |
| 307 | 287 |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 581 leading_width += padding + location_icon_view_->GetMinimumSize().width(); | 561 leading_width += padding + location_icon_view_->GetMinimumSize().width(); |
| 582 } | 562 } |
| 583 | 563 |
| 584 // Compute width of omnibox-trailing content. | 564 // Compute width of omnibox-trailing content. |
| 585 int trailing_width = horizontal_edge_thickness; | 565 int trailing_width = horizontal_edge_thickness; |
| 586 trailing_width += IncrementalMinimumWidth(star_view_) + | 566 trailing_width += IncrementalMinimumWidth(star_view_) + |
| 587 IncrementalMinimumWidth(translate_icon_view_) + | 567 IncrementalMinimumWidth(translate_icon_view_) + |
| 588 IncrementalMinimumWidth(open_pdf_in_reader_view_) + | 568 IncrementalMinimumWidth(open_pdf_in_reader_view_) + |
| 589 IncrementalMinimumWidth(save_credit_card_icon_view_) + | 569 IncrementalMinimumWidth(save_credit_card_icon_view_) + |
| 590 IncrementalMinimumWidth(manage_passwords_icon_view_) + | 570 IncrementalMinimumWidth(manage_passwords_icon_view_) + |
| 591 IncrementalMinimumWidth(zoom_view_) + | 571 IncrementalMinimumWidth(zoom_view_); |
| 592 IncrementalMinimumWidth(mic_search_view_); | |
| 593 for (PageActionViews::const_iterator i(page_action_views_.begin()); | 572 for (PageActionViews::const_iterator i(page_action_views_.begin()); |
| 594 i != page_action_views_.end(); ++i) | 573 i != page_action_views_.end(); ++i) |
| 595 trailing_width += IncrementalMinimumWidth((*i)); | 574 trailing_width += IncrementalMinimumWidth((*i)); |
| 596 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); | 575 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); |
| 597 i != content_setting_views_.end(); ++i) | 576 i != content_setting_views_.end(); ++i) |
| 598 trailing_width += IncrementalMinimumWidth((*i)); | 577 trailing_width += IncrementalMinimumWidth((*i)); |
| 599 | 578 |
| 600 min_size.set_width(leading_width + omnibox_view_->GetMinimumSize().width() + | 579 min_size.set_width(leading_width + omnibox_view_->GetMinimumSize().width() + |
| 601 2 * padding - omnibox_view_->GetInsets().width() + | 580 2 * padding - omnibox_view_->GetInsets().width() + |
| 602 trailing_width); | 581 trailing_width); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 705 } | 684 } |
| 706 for (ContentSettingViews::const_reverse_iterator i( | 685 for (ContentSettingViews::const_reverse_iterator i( |
| 707 content_setting_views_.rbegin()); i != content_setting_views_.rend(); | 686 content_setting_views_.rbegin()); i != content_setting_views_.rend(); |
| 708 ++i) { | 687 ++i) { |
| 709 if ((*i)->visible()) { | 688 if ((*i)->visible()) { |
| 710 trailing_decorations.AddDecoration(bubble_vertical_padding, bubble_height, | 689 trailing_decorations.AddDecoration(bubble_vertical_padding, bubble_height, |
| 711 false, 0, item_padding, item_padding, | 690 false, 0, item_padding, item_padding, |
| 712 *i); | 691 *i); |
| 713 } | 692 } |
| 714 } | 693 } |
| 715 if (mic_search_view_->visible()) { | |
| 716 trailing_decorations.AddDecoration(vertical_padding, location_height, | |
| 717 mic_search_view_); | |
| 718 } | |
| 719 // Because IMEs may eat the tab key, we don't show "press tab to search" while | 694 // Because IMEs may eat the tab key, we don't show "press tab to search" while |
| 720 // IME composition is in progress. | 695 // IME composition is in progress. |
| 721 if (!keyword.empty() && omnibox_view_->model()->is_keyword_hint() && | 696 if (!keyword.empty() && omnibox_view_->model()->is_keyword_hint() && |
| 722 !omnibox_view_->IsImeComposing()) { | 697 !omnibox_view_->IsImeComposing()) { |
| 723 trailing_decorations.AddDecoration(vertical_padding, location_height, true, | 698 trailing_decorations.AddDecoration(vertical_padding, location_height, true, |
| 724 0, item_padding, item_padding, | 699 0, item_padding, item_padding, |
| 725 keyword_hint_view_); | 700 keyword_hint_view_); |
| 726 if (keyword_hint_view_->keyword() != keyword) | 701 if (keyword_hint_view_->keyword() != keyword) |
| 727 keyword_hint_view_->SetKeyword(keyword); | 702 keyword_hint_view_->SetKeyword(keyword); |
| 728 } | 703 } |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 819 x = entry_width - width; | 794 x = entry_width - width; |
| 820 location_bounds.set_width(x); | 795 location_bounds.set_width(x); |
| 821 ime_inline_autocomplete_view_->SetBounds( | 796 ime_inline_autocomplete_view_->SetBounds( |
| 822 location_bounds.right(), location_bounds.y(), | 797 location_bounds.right(), location_bounds.y(), |
| 823 std::min(width, entry_width), location_bounds.height()); | 798 std::min(width, entry_width), location_bounds.height()); |
| 824 } | 799 } |
| 825 omnibox_view_->SetBoundsRect(location_bounds); | 800 omnibox_view_->SetBoundsRect(location_bounds); |
| 826 } | 801 } |
| 827 | 802 |
| 828 void LocationBarView::Update(const WebContents* contents) { | 803 void LocationBarView::Update(const WebContents* contents) { |
| 829 mic_search_view_->SetVisible( | |
| 830 !GetToolbarModel()->input_in_progress() && browser_ && | |
| 831 browser_->search_model()->voice_search_supported()); | |
| 832 RefreshContentSettingViews(); | 804 RefreshContentSettingViews(); |
| 833 RefreshZoomView(); | 805 RefreshZoomView(); |
| 834 RefreshPageActionViews(); | 806 RefreshPageActionViews(); |
| 835 RefreshTranslateIcon(); | 807 RefreshTranslateIcon(); |
| 836 RefreshSaveCreditCardIconView(); | 808 RefreshSaveCreditCardIconView(); |
| 837 RefreshManagePasswordsIconView(); | 809 RefreshManagePasswordsIconView(); |
| 838 content::WebContents* web_contents_for_sub_views = | 810 content::WebContents* web_contents_for_sub_views = |
| 839 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents(); | 811 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents(); |
| 840 open_pdf_in_reader_view_->Update(web_contents_for_sub_views); | 812 open_pdf_in_reader_view_->Update(web_contents_for_sub_views); |
| 841 | 813 |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1334 // by simply expanding the paint area outside the view by the edge thickness. | 1306 // by simply expanding the paint area outside the view by the edge thickness. |
| 1335 gfx::Rect border_rect(GetContentsBounds()); | 1307 gfx::Rect border_rect(GetContentsBounds()); |
| 1336 if (is_popup_mode_ && (GetHorizontalEdgeThickness() == 0)) | 1308 if (is_popup_mode_ && (GetHorizontalEdgeThickness() == 0)) |
| 1337 border_rect.Inset(-kPopupEdgeThickness, 0); | 1309 border_rect.Inset(-kPopupEdgeThickness, 0); |
| 1338 | 1310 |
| 1339 views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(), | 1311 views::Painter::PaintPainterAt(recorder.canvas(), border_painter_.get(), |
| 1340 border_rect); | 1312 border_rect); |
| 1341 } | 1313 } |
| 1342 | 1314 |
| 1343 //////////////////////////////////////////////////////////////////////////////// | 1315 //////////////////////////////////////////////////////////////////////////////// |
| 1344 // LocationBarView, private views::ButtonListener implementation: | |
| 1345 | |
| 1346 void LocationBarView::ButtonPressed(views::Button* sender, | |
| 1347 const ui::Event& event) { | |
| 1348 DCHECK_EQ(mic_search_view_, sender); | |
| 1349 command_updater()->ExecuteCommand(IDC_TOGGLE_SPEECH_INPUT); | |
|
msw
2015/11/06 23:59:23
Remove IDC_TOGGLE_SPEECH_INPUT and uses?
| |
| 1350 } | |
| 1351 | |
| 1352 //////////////////////////////////////////////////////////////////////////////// | |
| 1353 // LocationBarView, private views::DragController implementation: | 1316 // LocationBarView, private views::DragController implementation: |
| 1354 | 1317 |
| 1355 void LocationBarView::WriteDragDataForView(views::View* sender, | 1318 void LocationBarView::WriteDragDataForView(views::View* sender, |
| 1356 const gfx::Point& press_pt, | 1319 const gfx::Point& press_pt, |
| 1357 OSExchangeData* data) { | 1320 OSExchangeData* data) { |
| 1358 DCHECK_NE(GetDragOperationsForView(sender, press_pt), | 1321 DCHECK_NE(GetDragOperationsForView(sender, press_pt), |
| 1359 ui::DragDropTypes::DRAG_NONE); | 1322 ui::DragDropTypes::DRAG_NONE); |
| 1360 | 1323 |
| 1361 WebContents* web_contents = GetWebContents(); | 1324 WebContents* web_contents = GetWebContents(); |
| 1362 favicon::FaviconDriver* favicon_driver = | 1325 favicon::FaviconDriver* favicon_driver = |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1431 // LocationBarView, private TemplateURLServiceObserver implementation: | 1394 // LocationBarView, private TemplateURLServiceObserver implementation: |
| 1432 | 1395 |
| 1433 void LocationBarView::OnTemplateURLServiceChanged() { | 1396 void LocationBarView::OnTemplateURLServiceChanged() { |
| 1434 template_url_service_->RemoveObserver(this); | 1397 template_url_service_->RemoveObserver(this); |
| 1435 template_url_service_ = NULL; | 1398 template_url_service_ = NULL; |
| 1436 // If the browser is no longer active, let's not show the info bubble, as this | 1399 // If the browser is no longer active, let's not show the info bubble, as this |
| 1437 // would make the browser the active window again. | 1400 // would make the browser the active window again. |
| 1438 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1401 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
| 1439 ShowFirstRunBubble(); | 1402 ShowFirstRunBubble(); |
| 1440 } | 1403 } |
| 1441 | |
| 1442 //////////////////////////////////////////////////////////////////////////////// | |
| 1443 // LocationBarView, private SearchModelObserver implementation: | |
| 1444 | |
| 1445 void LocationBarView::ModelChanged(const SearchModel::State& old_state, | |
| 1446 const SearchModel::State& new_state) { | |
| 1447 const bool visible = !GetToolbarModel()->input_in_progress() && | |
| 1448 new_state.voice_search_supported; | |
| 1449 if (mic_search_view_->visible() != visible) { | |
| 1450 mic_search_view_->SetVisible(visible); | |
| 1451 Layout(); | |
| 1452 } | |
| 1453 } | |
| OLD | NEW |