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

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_view.cc

Issue 1081113002: Revert of [Extensions] Make extension message bubble factory platform-abstract (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months 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
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_view.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/toolbar/toolbar_view.h" 5 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/i18n/number_formatting.h" 10 #include "base/i18n/number_formatting.h"
(...skipping 13 matching lines...) Expand all
24 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" 24 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h"
25 #include "chrome/browser/ui/browser_instant_controller.h" 25 #include "chrome/browser/ui/browser_instant_controller.h"
26 #include "chrome/browser/ui/browser_tabstrip.h" 26 #include "chrome/browser/ui/browser_tabstrip.h"
27 #include "chrome/browser/ui/browser_window.h" 27 #include "chrome/browser/ui/browser_window.h"
28 #include "chrome/browser/ui/global_error/global_error_service.h" 28 #include "chrome/browser/ui/global_error/global_error_service.h"
29 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 29 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
30 #include "chrome/browser/ui/omnibox/omnibox_view.h" 30 #include "chrome/browser/ui/omnibox/omnibox_view.h"
31 #include "chrome/browser/ui/tabs/tab_strip_model.h" 31 #include "chrome/browser/ui/tabs/tab_strip_model.h"
32 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" 32 #include "chrome/browser/ui/toolbar/wrench_menu_model.h"
33 #include "chrome/browser/ui/view_ids.h" 33 #include "chrome/browser/ui/view_ids.h"
34 #include "chrome/browser/ui/views/extensions/extension_message_bubble_view.h"
34 #include "chrome/browser/ui/views/extensions/extension_popup.h" 35 #include "chrome/browser/ui/views/extensions/extension_popup.h"
35 #include "chrome/browser/ui/views/frame/browser_view.h" 36 #include "chrome/browser/ui/views/frame/browser_view.h"
36 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" 37 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
37 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" 38 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h"
38 #include "chrome/browser/ui/views/location_bar/star_view.h" 39 #include "chrome/browser/ui/views/location_bar/star_view.h"
39 #include "chrome/browser/ui/views/location_bar/translate_icon_view.h" 40 #include "chrome/browser/ui/views/location_bar/translate_icon_view.h"
40 #include "chrome/browser/ui/views/outdated_upgrade_bubble_view.h" 41 #include "chrome/browser/ui/views/outdated_upgrade_bubble_view.h"
41 #include "chrome/browser/ui/views/toolbar/back_button.h" 42 #include "chrome/browser/ui/views/toolbar/back_button.h"
42 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" 43 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h"
43 #include "chrome/browser/ui/views/toolbar/home_button.h" 44 #include "chrome/browser/ui/views/toolbar/home_button.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 123
123 ToolbarView::ToolbarView(Browser* browser) 124 ToolbarView::ToolbarView(Browser* browser)
124 : back_(NULL), 125 : back_(NULL),
125 forward_(NULL), 126 forward_(NULL),
126 reload_(NULL), 127 reload_(NULL),
127 home_(NULL), 128 home_(NULL),
128 location_bar_(NULL), 129 location_bar_(NULL),
129 browser_actions_(NULL), 130 browser_actions_(NULL),
130 app_menu_(NULL), 131 app_menu_(NULL),
131 browser_(browser), 132 browser_(browser),
132 badge_controller_(browser->profile(), this) { 133 badge_controller_(browser->profile(), this),
134 extension_message_bubble_factory_(
135 new extensions::ExtensionMessageBubbleFactory(browser->profile(),
136 this)) {
133 set_id(VIEW_ID_TOOLBAR); 137 set_id(VIEW_ID_TOOLBAR);
134 138
135 SetEventTargeter( 139 SetEventTargeter(
136 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); 140 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this)));
137 141
138 chrome::AddCommandObserver(browser_, IDC_BACK, this); 142 chrome::AddCommandObserver(browser_, IDC_BACK, this);
139 chrome::AddCommandObserver(browser_, IDC_FORWARD, this); 143 chrome::AddCommandObserver(browser_, IDC_FORWARD, this);
140 chrome::AddCommandObserver(browser_, IDC_RELOAD, this); 144 chrome::AddCommandObserver(browser_, IDC_RELOAD, this);
141 chrome::AddCommandObserver(browser_, IDC_HOME, this); 145 chrome::AddCommandObserver(browser_, IDC_HOME, this);
142 chrome::AddCommandObserver(browser_, IDC_LOAD_NEW_TAB_PAGE, this); 146 chrome::AddCommandObserver(browser_, IDC_LOAD_NEW_TAB_PAGE, this);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // Accessibility specific tooltip text. 264 // Accessibility specific tooltip text.
261 if (content::BrowserAccessibilityState::GetInstance()-> 265 if (content::BrowserAccessibilityState::GetInstance()->
262 IsAccessibleBrowser()) { 266 IsAccessibleBrowser()) {
263 back_->SetTooltipText( 267 back_->SetTooltipText(
264 l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLTIP_BACK)); 268 l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLTIP_BACK));
265 forward_->SetTooltipText( 269 forward_->SetTooltipText(
266 l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLTIP_FORWARD)); 270 l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLTIP_FORWARD));
267 } 271 }
268 } 272 }
269 273
274 void ToolbarView::OnWidgetVisibilityChanged(views::Widget* widget,
275 bool visible) {
276 if (visible) {
277 // Safe to call multiple times; the bubble will only appear once.
278 extension_message_bubble_factory_->MaybeShow(app_menu_);
279 }
280 }
281
270 void ToolbarView::OnWidgetActivationChanged(views::Widget* widget, 282 void ToolbarView::OnWidgetActivationChanged(views::Widget* widget,
271 bool active) { 283 bool active) {
272 extensions::ExtensionCommandsGlobalRegistry* registry = 284 extensions::ExtensionCommandsGlobalRegistry* registry =
273 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile()); 285 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile());
274 if (active) { 286 if (active) {
275 registry->set_registry_for_active_window( 287 registry->set_registry_for_active_window(
276 browser_actions_->extension_keybinding_registry()); 288 browser_actions_->extension_keybinding_registry());
277 } else if (registry->registry_for_active_window() == 289 } else if (registry->registry_for_active_window() ==
278 browser_actions_->extension_keybinding_registry()) { 290 browser_actions_->extension_keybinding_registry()) {
279 registry->set_registry_for_active_window(nullptr); 291 registry->set_registry_for_active_window(nullptr);
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 792
781 void ToolbarView::OnShowHomeButtonChanged() { 793 void ToolbarView::OnShowHomeButtonChanged() {
782 Layout(); 794 Layout();
783 SchedulePaint(); 795 SchedulePaint();
784 } 796 }
785 797
786 int ToolbarView::content_shadow_height() const { 798 int ToolbarView::content_shadow_height() const {
787 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? 799 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ?
788 kContentShadowHeightAsh : kContentShadowHeight; 800 kContentShadowHeightAsh : kContentShadowHeight;
789 } 801 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_view.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698