| Index: chrome/browser/extensions/api/management/management_api.h
|
| diff --git a/chrome/browser/extensions/api/management/management_api.h b/chrome/browser/extensions/api/management/management_api.h
|
| index d81051024955bc91d3189a9ef4da3a87da564e9e..1bb39ee865ec387880da493e315722972673a62c 100644
|
| --- a/chrome/browser/extensions/api/management/management_api.h
|
| +++ b/chrome/browser/extensions/api/management/management_api.h
|
| @@ -6,6 +6,7 @@
|
| #define CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_
|
|
|
| #include "base/compiler_specific.h"
|
| +#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
|
| #include "chrome/browser/extensions/event_router.h"
|
| #include "chrome/browser/extensions/extension_function.h"
|
| #include "chrome/browser/extensions/extension_install_prompt.h"
|
| @@ -17,21 +18,23 @@
|
| class ExtensionService;
|
| class ExtensionUninstallDialog;
|
|
|
| -class ExtensionManagementFunction : public SyncExtensionFunction {
|
| +namespace extensions {
|
| +
|
| +class ManagementFunction : public SyncExtensionFunction {
|
| protected:
|
| - virtual ~ExtensionManagementFunction() {}
|
| + virtual ~ManagementFunction() {}
|
|
|
| ExtensionService* service();
|
| };
|
|
|
| -class AsyncExtensionManagementFunction : public AsyncExtensionFunction {
|
| +class AsyncManagementFunction : public AsyncExtensionFunction {
|
| protected:
|
| - virtual ~AsyncExtensionManagementFunction() {}
|
| + virtual ~AsyncManagementFunction() {}
|
|
|
| ExtensionService* service();
|
| };
|
|
|
| -class GetAllExtensionsFunction : public ExtensionManagementFunction {
|
| +class GetAllExtensionsFunction : public ManagementFunction {
|
| public:
|
| DECLARE_EXTENSION_FUNCTION_NAME("management.getAll");
|
|
|
| @@ -42,7 +45,7 @@ class GetAllExtensionsFunction : public ExtensionManagementFunction {
|
| virtual bool RunImpl() OVERRIDE;
|
| };
|
|
|
| -class GetExtensionByIdFunction : public ExtensionManagementFunction {
|
| +class GetExtensionByIdFunction : public ManagementFunction {
|
| public:
|
| DECLARE_EXTENSION_FUNCTION_NAME("management.get");
|
|
|
| @@ -53,7 +56,7 @@ class GetExtensionByIdFunction : public ExtensionManagementFunction {
|
| virtual bool RunImpl() OVERRIDE;
|
| };
|
|
|
| -class GetPermissionWarningsByIdFunction : public ExtensionManagementFunction {
|
| +class GetPermissionWarningsByIdFunction : public ManagementFunction {
|
| public:
|
| DECLARE_EXTENSION_FUNCTION_NAME("management.getPermissionWarningsById");
|
|
|
| @@ -80,7 +83,7 @@ class GetPermissionWarningsByManifestFunction : public AsyncExtensionFunction {
|
| virtual bool RunImpl() OVERRIDE;
|
| };
|
|
|
| -class LaunchAppFunction : public ExtensionManagementFunction {
|
| +class LaunchAppFunction : public ManagementFunction {
|
| public:
|
| DECLARE_EXTENSION_FUNCTION_NAME("management.launchApp");
|
|
|
| @@ -91,7 +94,7 @@ class LaunchAppFunction : public ExtensionManagementFunction {
|
| virtual bool RunImpl() OVERRIDE;
|
| };
|
|
|
| -class SetEnabledFunction : public AsyncExtensionManagementFunction,
|
| +class SetEnabledFunction : public AsyncManagementFunction,
|
| public ExtensionInstallPrompt::Delegate {
|
| public:
|
| DECLARE_EXTENSION_FUNCTION_NAME("management.setEnabled");
|
| @@ -115,7 +118,7 @@ class SetEnabledFunction : public AsyncExtensionManagementFunction,
|
| scoped_ptr<ExtensionInstallPrompt> install_prompt_;
|
| };
|
|
|
| -class UninstallFunction : public AsyncExtensionManagementFunction,
|
| +class UninstallFunction : public AsyncManagementFunction,
|
| public ExtensionUninstallDialog::Delegate {
|
| public:
|
| DECLARE_EXTENSION_FUNCTION_NAME("management.uninstall");
|
| @@ -141,10 +144,10 @@ class UninstallFunction : public AsyncExtensionManagementFunction,
|
| scoped_ptr<ExtensionUninstallDialog> extension_uninstall_dialog_;
|
| };
|
|
|
| -class ExtensionManagementEventRouter : public content::NotificationObserver {
|
| +class ManagementEventRouter : public content::NotificationObserver {
|
| public:
|
| - explicit ExtensionManagementEventRouter(Profile* profile);
|
| - virtual ~ExtensionManagementEventRouter();
|
| + explicit ManagementEventRouter(Profile* profile);
|
| + virtual ~ManagementEventRouter();
|
|
|
| private:
|
| // content::NotificationObserver implementation.
|
| @@ -156,27 +159,42 @@ class ExtensionManagementEventRouter : public content::NotificationObserver {
|
|
|
| Profile* profile_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(ExtensionManagementEventRouter);
|
| + DISALLOW_COPY_AND_ASSIGN(ManagementEventRouter);
|
| };
|
|
|
| -class ExtensionManagementAPI : public ProfileKeyedService,
|
| - public extensions::EventRouter::Observer {
|
| +class ManagementAPI : public ProfileKeyedAPI,
|
| + public extensions::EventRouter::Observer {
|
| public:
|
| - explicit ExtensionManagementAPI(Profile* profile);
|
| - virtual ~ExtensionManagementAPI();
|
| + explicit ManagementAPI(Profile* profile);
|
| + virtual ~ManagementAPI();
|
|
|
| // ProfileKeyedService implementation.
|
| virtual void Shutdown() OVERRIDE;
|
|
|
| + // ProfileKeyedAPI implementation.
|
| + static ProfileKeyedAPIFactory<ManagementAPI>* GetFactoryInstance();
|
| +
|
| // EventRouter::Observer implementation.
|
| virtual void OnListenerAdded(const extensions::EventListenerInfo& details)
|
| OVERRIDE;
|
|
|
| private:
|
| + friend class ProfileKeyedAPIFactory<ManagementAPI>;
|
| +
|
| Profile* profile_;
|
|
|
| + // ProfileKeyedAPI implementation.
|
| + static const char* service_name() {
|
| + return "ManagementAPI";
|
| + }
|
| + static const bool kServiceIsNULLWhileTesting = true;
|
| +
|
| // Created lazily upon OnListenerAdded.
|
| - scoped_ptr<ExtensionManagementEventRouter> management_event_router_;
|
| + scoped_ptr<ManagementEventRouter> management_event_router_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ManagementAPI);
|
| };
|
|
|
| +} // namespace extensions
|
| +
|
| #endif // CHROME_BROWSER_EXTENSIONS_API_MANAGEMENT_MANAGEMENT_API_H_
|
|
|