| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_API_H__ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_API_H__ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_API_H__ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_API_H__ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "chrome/browser/extensions/extension_function.h" | 10 #include "chrome/browser/extensions/extension_function.h" |
| 11 #include "content/common/notification_observer.h" | 11 #include "content/common/notification_observer.h" |
| 12 #include "content/common/notification_registrar.h" | 12 #include "content/common/notification_registrar.h" |
| 13 | 13 |
| 14 class ExtensionService; | 14 class ExtensionService; |
| 15 | 15 |
| 16 class ExtensionManagementFunction : public SyncExtensionFunction { | 16 class ExtensionManagementFunction : public SyncExtensionFunction { |
| 17 protected: | 17 protected: |
| 18 ExtensionService* service(); | 18 ExtensionService* service(); |
| 19 }; | 19 }; |
| 20 | 20 |
| 21 class GetAllExtensionsFunction : public ExtensionManagementFunction { | 21 class GetAllExtensionsFunction : public ExtensionManagementFunction { |
| 22 ~GetAllExtensionsFunction() {} | 22 virtual ~GetAllExtensionsFunction() {} |
| 23 virtual bool RunImpl(); | 23 virtual bool RunImpl(); |
| 24 DECLARE_EXTENSION_FUNCTION_NAME("management.getAll"); | 24 DECLARE_EXTENSION_FUNCTION_NAME("management.getAll"); |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 class GetExtensionByIdFunction : public ExtensionManagementFunction { | 27 class GetExtensionByIdFunction : public ExtensionManagementFunction { |
| 28 ~GetExtensionByIdFunction() {} | 28 virtual ~GetExtensionByIdFunction() {} |
| 29 virtual bool RunImpl(); | 29 virtual bool RunImpl(); |
| 30 DECLARE_EXTENSION_FUNCTION_NAME("management.get"); | 30 DECLARE_EXTENSION_FUNCTION_NAME("management.get"); |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 class LaunchAppFunction : public ExtensionManagementFunction { | 33 class LaunchAppFunction : public ExtensionManagementFunction { |
| 34 ~LaunchAppFunction() {} | 34 virtual ~LaunchAppFunction() {} |
| 35 virtual bool RunImpl(); | 35 virtual bool RunImpl(); |
| 36 DECLARE_EXTENSION_FUNCTION_NAME("management.launchApp"); | 36 DECLARE_EXTENSION_FUNCTION_NAME("management.launchApp"); |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 class SetEnabledFunction : public ExtensionManagementFunction { | 39 class SetEnabledFunction : public ExtensionManagementFunction { |
| 40 ~SetEnabledFunction() {} | 40 virtual ~SetEnabledFunction() {} |
| 41 virtual bool RunImpl(); | 41 virtual bool RunImpl(); |
| 42 DECLARE_EXTENSION_FUNCTION_NAME("management.setEnabled"); | 42 DECLARE_EXTENSION_FUNCTION_NAME("management.setEnabled"); |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 class UninstallFunction : public ExtensionManagementFunction { | 45 class UninstallFunction : public ExtensionManagementFunction { |
| 46 ~UninstallFunction() {} | 46 virtual ~UninstallFunction() {} |
| 47 virtual bool RunImpl(); | 47 virtual bool RunImpl(); |
| 48 DECLARE_EXTENSION_FUNCTION_NAME("management.uninstall"); | 48 DECLARE_EXTENSION_FUNCTION_NAME("management.uninstall"); |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 class ExtensionManagementEventRouter : public NotificationObserver { | 51 class ExtensionManagementEventRouter : public NotificationObserver { |
| 52 public: | 52 public: |
| 53 // Get the singleton instance of the event router. | 53 // Get the singleton instance of the event router. |
| 54 static ExtensionManagementEventRouter* GetInstance(); | 54 static ExtensionManagementEventRouter* GetInstance(); |
| 55 | 55 |
| 56 // Performs one-time initialization of our singleton. | 56 // Performs one-time initialization of our singleton. |
| 57 void Init(); | 57 void Init(); |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 friend struct DefaultSingletonTraits<ExtensionManagementEventRouter>; | 60 friend struct DefaultSingletonTraits<ExtensionManagementEventRouter>; |
| 61 | 61 |
| 62 ExtensionManagementEventRouter(); | 62 ExtensionManagementEventRouter(); |
| 63 virtual ~ExtensionManagementEventRouter(); | 63 virtual ~ExtensionManagementEventRouter(); |
| 64 | 64 |
| 65 // NotificationObserver implementation. | 65 // NotificationObserver implementation. |
| 66 virtual void Observe(NotificationType type, | 66 virtual void Observe(NotificationType type, |
| 67 const NotificationSource& source, | 67 const NotificationSource& source, |
| 68 const NotificationDetails& details); | 68 const NotificationDetails& details); |
| 69 | 69 |
| 70 NotificationRegistrar registrar_; | 70 NotificationRegistrar registrar_; |
| 71 | 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(ExtensionManagementEventRouter); | 72 DISALLOW_COPY_AND_ASSIGN(ExtensionManagementEventRouter); |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_API_H__ | 75 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MANAGEMENT_API_H__ |
| OLD | NEW |