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

Side by Side Diff: chrome/browser/ui/views/browser_actions_container.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser_actions_container.h" 5 #include "chrome/browser/ui/views/browser_actions_container.h"
6 6
7 #include "base/stl_util-inl.h" 7 #include "base/stl_util-inl.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/extensions/extension_browser_event_router.h" 10 #include "chrome/browser/extensions/extension_browser_event_router.h"
11 #include "chrome/browser/extensions/extension_host.h" 11 #include "chrome/browser/extensions/extension_host.h"
12 #include "chrome/browser/extensions/extension_service.h" 12 #include "chrome/browser/extensions/extension_service.h"
13 #include "chrome/browser/extensions/extension_tabs_module.h" 13 #include "chrome/browser/extensions/extension_tabs_module.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/sessions/restore_tab_helper.h" 15 #include "chrome/browser/sessions/restore_tab_helper.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_window.h" 17 #include "chrome/browser/ui/browser_window.h"
18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 18 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
19 #include "chrome/browser/ui/view_ids.h" 19 #include "chrome/browser/ui/view_ids.h"
20 #include "chrome/browser/ui/views/detachable_toolbar_view.h" 20 #include "chrome/browser/ui/views/detachable_toolbar_view.h"
21 #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h" 21 #include "chrome/browser/ui/views/extensions/browser_action_drag_data.h"
22 #include "chrome/browser/ui/views/extensions/extension_popup.h" 22 #include "chrome/browser/ui/views/extensions/extension_popup.h"
23 #include "chrome/browser/ui/views/toolbar_view.h" 23 #include "chrome/browser/ui/views/toolbar_view.h"
24 #include "chrome/common/chrome_notification_types.h"
24 #include "chrome/common/extensions/extension_action.h" 25 #include "chrome/common/extensions/extension_action.h"
25 #include "chrome/common/extensions/extension_resource.h" 26 #include "chrome/common/extensions/extension_resource.h"
26 #include "chrome/common/pref_names.h" 27 #include "chrome/common/pref_names.h"
27 #include "content/browser/renderer_host/render_view_host.h" 28 #include "content/browser/renderer_host/render_view_host.h"
28 #include "content/browser/renderer_host/render_widget_host_view.h" 29 #include "content/browser/renderer_host/render_widget_host_view.h"
29 #include "content/browser/tab_contents/tab_contents.h" 30 #include "content/browser/tab_contents/tab_contents.h"
30 #include "content/common/notification_source.h" 31 #include "content/common/notification_source.h"
31 #include "content/common/notification_type.h"
32 #include "grit/generated_resources.h" 32 #include "grit/generated_resources.h"
33 #include "grit/theme_resources.h" 33 #include "grit/theme_resources.h"
34 #include "grit/theme_resources_standard.h" 34 #include "grit/theme_resources_standard.h"
35 #include "grit/ui_resources.h" 35 #include "grit/ui_resources.h"
36 #include "third_party/skia/include/core/SkBitmap.h" 36 #include "third_party/skia/include/core/SkBitmap.h"
37 #include "third_party/skia/include/effects/SkGradientShader.h" 37 #include "third_party/skia/include/effects/SkGradientShader.h"
38 #include "ui/base/accessibility/accessible_view_state.h" 38 #include "ui/base/accessibility/accessible_view_state.h"
39 #include "ui/base/animation/slide_animation.h" 39 #include "ui/base/animation/slide_animation.h"
40 #include "ui/base/l10n/l10n_util.h" 40 #include "ui/base/l10n/l10n_util.h"
41 #include "ui/base/resource/resource_bundle.h" 41 #include "ui/base/resource/resource_bundle.h"
(...skipping 27 matching lines...) Expand all
69 extension_(extension), 69 extension_(extension),
70 ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)), 70 ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)),
71 panel_(panel), 71 panel_(panel),
72 context_menu_(NULL) { 72 context_menu_(NULL) {
73 set_border(NULL); 73 set_border(NULL);
74 set_alignment(TextButton::ALIGN_CENTER); 74 set_alignment(TextButton::ALIGN_CENTER);
75 75
76 // No UpdateState() here because View hierarchy not setup yet. Our parent 76 // No UpdateState() here because View hierarchy not setup yet. Our parent
77 // should call UpdateState() after creation. 77 // should call UpdateState() after creation.
78 78
79 registrar_.Add(this, NotificationType::EXTENSION_BROWSER_ACTION_UPDATED, 79 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED,
80 Source<ExtensionAction>(browser_action_)); 80 Source<ExtensionAction>(browser_action_));
81 } 81 }
82 82
83 void BrowserActionButton::Destroy() { 83 void BrowserActionButton::Destroy() {
84 if (context_menu_) { 84 if (context_menu_) {
85 context_menu_->Cancel(); 85 context_menu_->Cancel();
86 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 86 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
87 } else { 87 } else {
88 delete this; 88 delete this;
89 } 89 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 bool BrowserActionButton::IsPopup() { 179 bool BrowserActionButton::IsPopup() {
180 int tab_id = panel_->GetCurrentTabId(); 180 int tab_id = panel_->GetCurrentTabId();
181 return (tab_id < 0) ? false : browser_action_->HasPopup(tab_id); 181 return (tab_id < 0) ? false : browser_action_->HasPopup(tab_id);
182 } 182 }
183 183
184 GURL BrowserActionButton::GetPopupUrl() { 184 GURL BrowserActionButton::GetPopupUrl() {
185 int tab_id = panel_->GetCurrentTabId(); 185 int tab_id = panel_->GetCurrentTabId();
186 return (tab_id < 0) ? GURL() : browser_action_->GetPopupUrl(tab_id); 186 return (tab_id < 0) ? GURL() : browser_action_->GetPopupUrl(tab_id);
187 } 187 }
188 188
189 void BrowserActionButton::Observe(NotificationType type, 189 void BrowserActionButton::Observe(int type,
190 const NotificationSource& source, 190 const NotificationSource& source,
191 const NotificationDetails& details) { 191 const NotificationDetails& details) {
192 DCHECK(type == NotificationType::EXTENSION_BROWSER_ACTION_UPDATED); 192 DCHECK(type == chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED);
193 UpdateState(); 193 UpdateState();
194 // The browser action may have become visible/hidden so we need to make 194 // The browser action may have become visible/hidden so we need to make
195 // sure the state gets updated. 195 // sure the state gets updated.
196 panel_->OnBrowserActionVisibilityChanged(); 196 panel_->OnBrowserActionVisibilityChanged();
197 } 197 }
198 198
199 bool BrowserActionButton::Activate() { 199 bool BrowserActionButton::Activate() {
200 if (!IsPopup()) 200 if (!IsPopup())
201 return true; 201 return true;
202 202
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 } 1097 }
1098 } 1098 }
1099 1099
1100 bool BrowserActionsContainer::ShouldDisplayBrowserAction( 1100 bool BrowserActionsContainer::ShouldDisplayBrowserAction(
1101 const Extension* extension) { 1101 const Extension* extension) {
1102 // Only display incognito-enabled extensions while in incognito mode. 1102 // Only display incognito-enabled extensions while in incognito mode.
1103 return 1103 return
1104 (!profile_->IsOffTheRecord() || 1104 (!profile_->IsOffTheRecord() ||
1105 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); 1105 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id()));
1106 } 1106 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/browser_actions_container.h ('k') | chrome/browser/ui/views/bubble/bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698