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

Side by Side Diff: chrome/browser/ui/webui/extensions/extension_settings_handler.h

Issue 555323002: Deprecate direct use of legacy extension management preference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes addressing #12 Created 6 years, 3 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
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 #ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/prefs/pref_change_registrar.h"
14 #include "base/scoped_observer.h" 13 #include "base/scoped_observer.h"
15 #include "chrome/browser/extensions/error_console/error_console.h" 14 #include "chrome/browser/extensions/error_console/error_console.h"
16 #include "chrome/browser/extensions/extension_install_prompt.h" 15 #include "chrome/browser/extensions/extension_install_prompt.h"
17 #include "chrome/browser/extensions/extension_install_ui.h" 16 #include "chrome/browser/extensions/extension_install_ui.h"
17 #include "chrome/browser/extensions/extension_management.h"
18 #include "chrome/browser/extensions/extension_uninstall_dialog.h" 18 #include "chrome/browser/extensions/extension_uninstall_dialog.h"
19 #include "chrome/browser/extensions/requirements_checker.h" 19 #include "chrome/browser/extensions/requirements_checker.h"
20 #include "content/public/browser/navigation_controller.h" 20 #include "content/public/browser/navigation_controller.h"
21 #include "content/public/browser/notification_observer.h" 21 #include "content/public/browser/notification_observer.h"
22 #include "content/public/browser/notification_registrar.h" 22 #include "content/public/browser/notification_registrar.h"
23 #include "content/public/browser/web_contents_observer.h" 23 #include "content/public/browser/web_contents_observer.h"
24 #include "content/public/browser/web_ui_message_handler.h" 24 #include "content/public/browser/web_ui_message_handler.h"
25 #include "extensions/browser/extension_prefs.h" 25 #include "extensions/browser/extension_prefs.h"
26 #include "extensions/browser/extension_prefs_observer.h" 26 #include "extensions/browser/extension_prefs_observer.h"
27 #include "extensions/browser/extension_registry_observer.h" 27 #include "extensions/browser/extension_registry_observer.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 bool generated_background_page; 64 bool generated_background_page;
65 }; 65 };
66 66
67 // Extension Settings UI handler. 67 // Extension Settings UI handler.
68 class ExtensionSettingsHandler 68 class ExtensionSettingsHandler
69 : public content::WebUIMessageHandler, 69 : public content::WebUIMessageHandler,
70 public content::NotificationObserver, 70 public content::NotificationObserver,
71 public content::WebContentsObserver, 71 public content::WebContentsObserver,
72 public ErrorConsole::Observer, 72 public ErrorConsole::Observer,
73 public ExtensionInstallPrompt::Delegate, 73 public ExtensionInstallPrompt::Delegate,
74 public ExtensionManagement::Observer,
74 public ExtensionPrefsObserver, 75 public ExtensionPrefsObserver,
75 public ExtensionRegistryObserver, 76 public ExtensionRegistryObserver,
76 public ExtensionUninstallDialog::Delegate, 77 public ExtensionUninstallDialog::Delegate,
77 public WarningService::Observer, 78 public WarningService::Observer,
78 public base::SupportsWeakPtr<ExtensionSettingsHandler> { 79 public base::SupportsWeakPtr<ExtensionSettingsHandler> {
79 public: 80 public:
80 ExtensionSettingsHandler(); 81 ExtensionSettingsHandler();
81 virtual ~ExtensionSettingsHandler(); 82 virtual ~ExtensionSettingsHandler();
82 83
83 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 84 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 UnloadedExtensionInfo::Reason reason) OVERRIDE; 128 UnloadedExtensionInfo::Reason reason) OVERRIDE;
128 virtual void OnExtensionUninstalled( 129 virtual void OnExtensionUninstalled(
129 content::BrowserContext* browser_context, 130 content::BrowserContext* browser_context,
130 const Extension* extension, 131 const Extension* extension,
131 extensions::UninstallReason reason) OVERRIDE; 132 extensions::UninstallReason reason) OVERRIDE;
132 133
133 // ExtensionPrefsObserver implementation. 134 // ExtensionPrefsObserver implementation.
134 virtual void OnExtensionDisableReasonsChanged(const std::string& extension_id, 135 virtual void OnExtensionDisableReasonsChanged(const std::string& extension_id,
135 int disable_reasons) OVERRIDE; 136 int disable_reasons) OVERRIDE;
136 137
138 // ExtensionManagement::Observer implementation.
139 virtual void OnExtensionManagementSettingsChanged() OVERRIDE;
140
137 // ExtensionUninstallDialog::Delegate implementation, used for receiving 141 // ExtensionUninstallDialog::Delegate implementation, used for receiving
138 // notification about uninstall confirmation dialog selections. 142 // notification about uninstall confirmation dialog selections.
139 virtual void ExtensionUninstallAccepted() OVERRIDE; 143 virtual void ExtensionUninstallAccepted() OVERRIDE;
140 virtual void ExtensionUninstallCanceled() OVERRIDE; 144 virtual void ExtensionUninstallCanceled() OVERRIDE;
141 145
142 // WarningService::Observer implementation. 146 // WarningService::Observer implementation.
143 virtual void ExtensionWarningsChanged() OVERRIDE; 147 virtual void ExtensionWarningsChanged() OVERRIDE;
144 148
145 // ExtensionInstallPrompt::Delegate implementation. 149 // ExtensionInstallPrompt::Delegate implementation.
146 virtual void InstallUIProceed() OVERRIDE; 150 virtual void InstallUIProceed() OVERRIDE;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 int deleting_rph_id_; 273 int deleting_rph_id_;
270 274
271 // We want to register for notifications only after we've responded at least 275 // We want to register for notifications only after we've responded at least
272 // once to the page, otherwise we'd be calling JavaScript functions on objects 276 // once to the page, otherwise we'd be calling JavaScript functions on objects
273 // that don't exist yet when notifications come in. This variable makes sure 277 // that don't exist yet when notifications come in. This variable makes sure
274 // we do so only once. 278 // we do so only once.
275 bool registered_for_notifications_; 279 bool registered_for_notifications_;
276 280
277 content::NotificationRegistrar registrar_; 281 content::NotificationRegistrar registrar_;
278 282
279 PrefChangeRegistrar pref_registrar_;
280
281 // This will not be empty when a requirements check is in progress. Doing 283 // This will not be empty when a requirements check is in progress. Doing
282 // another Check() before the previous one is complete will cause the first 284 // another Check() before the previous one is complete will cause the first
283 // one to abort. 285 // one to abort.
284 scoped_ptr<RequirementsChecker> requirements_checker_; 286 scoped_ptr<RequirementsChecker> requirements_checker_;
285 287
286 // The UI for showing what permissions the extension has. 288 // The UI for showing what permissions the extension has.
287 scoped_ptr<ExtensionInstallPrompt> prompt_; 289 scoped_ptr<ExtensionInstallPrompt> prompt_;
288 290
289 ScopedObserver<WarningService, WarningService::Observer> 291 ScopedObserver<WarningService, WarningService::Observer>
290 warning_service_observer_; 292 warning_service_observer_;
291 293
292 // An observer to listen for when Extension errors are reported. 294 // An observer to listen for when Extension errors are reported.
293 ScopedObserver<ErrorConsole, ErrorConsole::Observer> error_console_observer_; 295 ScopedObserver<ErrorConsole, ErrorConsole::Observer> error_console_observer_;
294 296
295 // An observer to listen for notable changes in the ExtensionPrefs, like 297 // An observer to listen for notable changes in the ExtensionPrefs, like
296 // a change in Disable Reasons. 298 // a change in Disable Reasons.
297 ScopedObserver<ExtensionPrefs, ExtensionPrefsObserver> 299 ScopedObserver<ExtensionPrefs, ExtensionPrefsObserver>
298 extension_prefs_observer_; 300 extension_prefs_observer_;
299 301
300 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> 302 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
301 extension_registry_observer_; 303 extension_registry_observer_;
302 304
305 ScopedObserver<ExtensionManagement, ExtensionManagement::Observer>
306 extension_management_observer_;
307
303 // Whether we found any DISABLE_NOT_VERIFIED extensions and want to kick off 308 // Whether we found any DISABLE_NOT_VERIFIED extensions and want to kick off
304 // a verification check to try and rescue them. 309 // a verification check to try and rescue them.
305 bool should_do_verification_check_; 310 bool should_do_verification_check_;
306 311
307 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler); 312 DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsHandler);
308 }; 313 };
309 314
310 } // namespace extensions 315 } // namespace extensions
311 316
312 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_ 317 #endif // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_management.cc ('k') | chrome/browser/ui/webui/extensions/extension_settings_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698