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

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

Issue 1087713002: [Reland] [Extensions] Make extension message bubble factory platform-abstract (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Finnur's 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"
35 #include "chrome/browser/ui/views/extensions/extension_popup.h" 34 #include "chrome/browser/ui/views/extensions/extension_popup.h"
36 #include "chrome/browser/ui/views/frame/browser_view.h" 35 #include "chrome/browser/ui/views/frame/browser_view.h"
37 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" 36 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
38 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" 37 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h"
39 #include "chrome/browser/ui/views/location_bar/star_view.h" 38 #include "chrome/browser/ui/views/location_bar/star_view.h"
40 #include "chrome/browser/ui/views/location_bar/translate_icon_view.h" 39 #include "chrome/browser/ui/views/location_bar/translate_icon_view.h"
41 #include "chrome/browser/ui/views/outdated_upgrade_bubble_view.h" 40 #include "chrome/browser/ui/views/outdated_upgrade_bubble_view.h"
42 #include "chrome/browser/ui/views/toolbar/back_button.h" 41 #include "chrome/browser/ui/views/toolbar/back_button.h"
43 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h" 42 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h"
44 #include "chrome/browser/ui/views/toolbar/home_button.h" 43 #include "chrome/browser/ui/views/toolbar/home_button.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 122
124 ToolbarView::ToolbarView(Browser* browser) 123 ToolbarView::ToolbarView(Browser* browser)
125 : back_(NULL), 124 : back_(NULL),
126 forward_(NULL), 125 forward_(NULL),
127 reload_(NULL), 126 reload_(NULL),
128 home_(NULL), 127 home_(NULL),
129 location_bar_(NULL), 128 location_bar_(NULL),
130 browser_actions_(NULL), 129 browser_actions_(NULL),
131 app_menu_(NULL), 130 app_menu_(NULL),
132 browser_(browser), 131 browser_(browser),
133 badge_controller_(browser->profile(), this), 132 badge_controller_(browser->profile(), this) {
134 extension_message_bubble_factory_(
135 new extensions::ExtensionMessageBubbleFactory(browser->profile(),
136 this)) {
137 set_id(VIEW_ID_TOOLBAR); 133 set_id(VIEW_ID_TOOLBAR);
138 134
139 SetEventTargeter( 135 SetEventTargeter(
140 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this))); 136 scoped_ptr<views::ViewTargeter>(new views::ViewTargeter(this)));
141 137
142 chrome::AddCommandObserver(browser_, IDC_BACK, this); 138 chrome::AddCommandObserver(browser_, IDC_BACK, this);
143 chrome::AddCommandObserver(browser_, IDC_FORWARD, this); 139 chrome::AddCommandObserver(browser_, IDC_FORWARD, this);
144 chrome::AddCommandObserver(browser_, IDC_RELOAD, this); 140 chrome::AddCommandObserver(browser_, IDC_RELOAD, this);
145 chrome::AddCommandObserver(browser_, IDC_HOME, this); 141 chrome::AddCommandObserver(browser_, IDC_HOME, this);
146 chrome::AddCommandObserver(browser_, IDC_LOAD_NEW_TAB_PAGE, this); 142 chrome::AddCommandObserver(browser_, IDC_LOAD_NEW_TAB_PAGE, this);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // Accessibility specific tooltip text. 260 // Accessibility specific tooltip text.
265 if (content::BrowserAccessibilityState::GetInstance()-> 261 if (content::BrowserAccessibilityState::GetInstance()->
266 IsAccessibleBrowser()) { 262 IsAccessibleBrowser()) {
267 back_->SetTooltipText( 263 back_->SetTooltipText(
268 l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLTIP_BACK)); 264 l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLTIP_BACK));
269 forward_->SetTooltipText( 265 forward_->SetTooltipText(
270 l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLTIP_FORWARD)); 266 l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLTIP_FORWARD));
271 } 267 }
272 } 268 }
273 269
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
282 void ToolbarView::OnWidgetActivationChanged(views::Widget* widget, 270 void ToolbarView::OnWidgetActivationChanged(views::Widget* widget,
283 bool active) { 271 bool active) {
284 extensions::ExtensionCommandsGlobalRegistry* registry = 272 extensions::ExtensionCommandsGlobalRegistry* registry =
285 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile()); 273 extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile());
286 if (active) { 274 if (active) {
287 registry->set_registry_for_active_window( 275 registry->set_registry_for_active_window(
288 browser_actions_->extension_keybinding_registry()); 276 browser_actions_->extension_keybinding_registry());
289 } else if (registry->registry_for_active_window() == 277 } else if (registry->registry_for_active_window() ==
290 browser_actions_->extension_keybinding_registry()) { 278 browser_actions_->extension_keybinding_registry()) {
291 registry->set_registry_for_active_window(nullptr); 279 registry->set_registry_for_active_window(nullptr);
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 780
793 void ToolbarView::OnShowHomeButtonChanged() { 781 void ToolbarView::OnShowHomeButtonChanged() {
794 Layout(); 782 Layout();
795 SchedulePaint(); 783 SchedulePaint();
796 } 784 }
797 785
798 int ToolbarView::content_shadow_height() const { 786 int ToolbarView::content_shadow_height() const {
799 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? 787 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ?
800 kContentShadowHeightAsh : kContentShadowHeight; 788 kContentShadowHeightAsh : kContentShadowHeight;
801 } 789 }
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