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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_action_context_menu.mm

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 #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h" 5 #import "chrome/browser/ui/cocoa/extensions/extension_action_context_menu.h"
6 6
7 #include "base/sys_string_conversions.h" 7 #include "base/sys_string_conversions.h"
8 #include "base/task.h" 8 #include "base/task.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_tabs_module.h" 10 #include "chrome/browser/extensions/extension_tabs_module.h"
11 #include "chrome/browser/extensions/extension_uninstall_dialog.h" 11 #include "chrome/browser/extensions/extension_uninstall_dialog.h"
12 #include "chrome/browser/prefs/pref_change_registrar.h" 12 #include "chrome/browser/prefs/pref_change_registrar.h"
13 #include "chrome/browser/prefs/pref_service.h" 13 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/browser_list.h" 15 #include "chrome/browser/ui/browser_list.h"
16 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" 16 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h"
17 #include "chrome/browser/ui/cocoa/browser_window_controller.h" 17 #include "chrome/browser/ui/cocoa/browser_window_controller.h"
18 #include "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h" 18 #include "chrome/browser/ui/cocoa/extensions/browser_actions_controller.h"
19 #include "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" 19 #include "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h"
20 #include "chrome/browser/ui/cocoa/info_bubble_view.h" 20 #include "chrome/browser/ui/cocoa/info_bubble_view.h"
21 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" 21 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
22 #include "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 22 #include "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
23 #include "chrome/common/chrome_notification_types.h"
23 #include "chrome/common/extensions/extension.h" 24 #include "chrome/common/extensions/extension.h"
24 #include "chrome/common/extensions/extension_action.h" 25 #include "chrome/common/extensions/extension_action.h"
25 #include "chrome/common/extensions/extension_constants.h" 26 #include "chrome/common/extensions/extension_constants.h"
26 #include "chrome/common/pref_names.h" 27 #include "chrome/common/pref_names.h"
27 #include "chrome/common/url_constants.h" 28 #include "chrome/common/url_constants.h"
28 #include "content/common/notification_details.h" 29 #include "content/common/notification_details.h"
29 #include "content/common/notification_observer.h" 30 #include "content/common/notification_observer.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 "ui/base/l10n/l10n_util_mac.h" 33 #include "ui/base/l10n/l10n_util_mac.h"
34 34
35 // A class that loads the extension icon on the I/O thread before showing the 35 // A class that loads the extension icon on the I/O thread before showing the
36 // confirmation dialog to uninstall the given extension. 36 // confirmation dialog to uninstall the given extension.
37 // Also acts as the extension's UI delegate in order to display the dialog. 37 // Also acts as the extension's UI delegate in order to display the dialog.
38 class AsyncUninstaller : public ExtensionUninstallDialog::Delegate { 38 class AsyncUninstaller : public ExtensionUninstallDialog::Delegate {
39 public: 39 public:
40 AsyncUninstaller(const Extension* extension, Profile* profile) 40 AsyncUninstaller(const Extension* extension, Profile* profile)
41 : extension_(extension), 41 : extension_(extension),
(...skipping 28 matching lines...) Expand all
70 class DevmodeObserver : public NotificationObserver { 70 class DevmodeObserver : public NotificationObserver {
71 public: 71 public:
72 DevmodeObserver(ExtensionActionContextMenu* menu, 72 DevmodeObserver(ExtensionActionContextMenu* menu,
73 PrefService* service) 73 PrefService* service)
74 : menu_(menu), pref_service_(service) { 74 : menu_(menu), pref_service_(service) {
75 registrar_.Init(pref_service_); 75 registrar_.Init(pref_service_);
76 registrar_.Add(prefs::kExtensionsUIDeveloperMode, this); 76 registrar_.Add(prefs::kExtensionsUIDeveloperMode, this);
77 } 77 }
78 virtual ~DevmodeObserver() {} 78 virtual ~DevmodeObserver() {}
79 79
80 void Observe(NotificationType type, 80 void Observe(int type,
81 const NotificationSource& source, 81 const NotificationSource& source,
82 const NotificationDetails& details) { 82 const NotificationDetails& details) {
83 if (type == NotificationType::PREF_CHANGED) 83 if (type == chrome::NOTIFICATION_PREF_CHANGED)
84 [menu_ updateInspectorItem]; 84 [menu_ updateInspectorItem];
85 else 85 else
86 NOTREACHED(); 86 NOTREACHED();
87 } 87 }
88 88
89 private: 89 private:
90 ExtensionActionContextMenu* menu_; 90 ExtensionActionContextMenu* menu_;
91 PrefService* pref_service_; 91 PrefService* pref_service_;
92 PrefChangeRegistrar registrar_; 92 PrefChangeRegistrar registrar_;
93 }; 93 };
94 94
95 class ProfileObserverBridge : public NotificationObserver { 95 class ProfileObserverBridge : public NotificationObserver {
96 public: 96 public:
97 ProfileObserverBridge(ExtensionActionContextMenu* owner, 97 ProfileObserverBridge(ExtensionActionContextMenu* owner,
98 const Profile* profile) 98 const Profile* profile)
99 : owner_(owner), 99 : owner_(owner),
100 profile_(profile) { 100 profile_(profile) {
101 registrar_.Add(this, NotificationType::PROFILE_DESTROYED, 101 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
102 Source<Profile>(profile)); 102 Source<Profile>(profile));
103 } 103 }
104 104
105 ~ProfileObserverBridge() {} 105 ~ProfileObserverBridge() {}
106 106
107 // Overridden from NotificationObserver 107 // Overridden from NotificationObserver
108 void Observe(NotificationType type, 108 void Observe(int type,
109 const NotificationSource& source, 109 const NotificationSource& source,
110 const NotificationDetails& details) { 110 const NotificationDetails& details) {
111 if (type == NotificationType::PROFILE_DESTROYED && 111 if (type == chrome::NOTIFICATION_PROFILE_DESTROYED &&
112 source == Source<Profile>(profile_)) { 112 source == Source<Profile>(profile_)) {
113 [owner_ invalidateProfile]; 113 [owner_ invalidateProfile];
114 } 114 }
115 } 115 }
116 116
117 private: 117 private:
118 ExtensionActionContextMenu* owner_; 118 ExtensionActionContextMenu* owner_;
119 const Profile* profile_; 119 const Profile* profile_;
120 NotificationRegistrar registrar_; 120 NotificationRegistrar registrar_;
121 }; 121 };
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 316 }
317 return YES; 317 return YES;
318 } 318 }
319 319
320 - (void)invalidateProfile { 320 - (void)invalidateProfile {
321 observer_.reset(); 321 observer_.reset();
322 profile_ = NULL; 322 profile_ = NULL;
323 } 323 }
324 324
325 @end 325 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698