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

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

Issue 11316163: Remove the last usages of PrefObserver outside of Prefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 8 years 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
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/gesture_prefs_observer_factory_aura.cc » ('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 (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 #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/prefs/public/pref_change_registrar.h" 7 #include "base/prefs/public/pref_change_registrar.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "chrome/browser/extensions/extension_action.h" 9 #include "chrome/browser/extensions/extension_action.h"
10 #include "chrome/browser/extensions/extension_action_manager.h" 10 #include "chrome/browser/extensions/extension_action_manager.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 @interface ExtensionActionContextMenu(Private) 82 @interface ExtensionActionContextMenu(Private)
83 // Callback for the context menu items. 83 // Callback for the context menu items.
84 - (void)dispatch:(id)menuItem; 84 - (void)dispatch:(id)menuItem;
85 85
86 // Runs the action for |menuItem|. 86 // Runs the action for |menuItem|.
87 - (void)updateInspectorItem; 87 - (void)updateInspectorItem;
88 @end 88 @end
89 89
90 namespace extension_action_context_menu { 90 namespace extension_action_context_menu {
91 91
92 class DevmodeObserver : public PrefObserver { 92 class DevmodeObserver {
93 public: 93 public:
94 DevmodeObserver(ExtensionActionContextMenu* menu, 94 DevmodeObserver(ExtensionActionContextMenu* menu,
95 PrefService* service) 95 PrefService* service)
96 : menu_(menu), pref_service_(service) { 96 : menu_(menu), pref_service_(service) {
97 registrar_.Init(pref_service_); 97 registrar_.Init(pref_service_);
98 registrar_.Add(prefs::kExtensionsUIDeveloperMode, this); 98 registrar_.Add(
99 prefs::kExtensionsUIDeveloperMode,
100 base::Bind(&DevmodeObserver::OnExtensionsUIDeveloperModeChanged,
101 base::Unretained(this)));
99 } 102 }
100 virtual ~DevmodeObserver() {} 103 virtual ~DevmodeObserver() {}
101 104
102 void OnPreferenceChanged(PrefServiceBase* service, 105 void OnExtensionsUIDeveloperModeChanged() {
103 const std::string& pref_name) {
104 [menu_ updateInspectorItem]; 106 [menu_ updateInspectorItem];
105 } 107 }
106 108
107 private: 109 private:
108 ExtensionActionContextMenu* menu_; 110 ExtensionActionContextMenu* menu_;
109 PrefService* pref_service_; 111 PrefService* pref_service_;
110 PrefChangeRegistrar registrar_; 112 PrefChangeRegistrar registrar_;
111 }; 113 };
112 114
113 } // namespace extension_action_context_menu 115 } // namespace extension_action_context_menu
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 281
280 - (BOOL)validateMenuItem:(NSMenuItem*)menuItem { 282 - (BOOL)validateMenuItem:(NSMenuItem*)menuItem {
281 if ([menuItem tag] == kExtensionContextOptions) { 283 if ([menuItem tag] == kExtensionContextOptions) {
282 // Disable 'Options' if there are no options to set. 284 // Disable 'Options' if there are no options to set.
283 return extension_->options_url().spec().length() > 0; 285 return extension_->options_url().spec().length() > 0;
284 } 286 }
285 return YES; 287 return YES;
286 } 288 }
287 289
288 @end 290 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/gesture_prefs_observer_factory_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698