| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_ | 5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_ |
| 6 #define EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_ | 6 #define EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "extensions/browser/extension_system.h" | 11 #include "extensions/browser/extension_system.h" |
| 12 #include "extensions/common/one_shot_event.h" | 12 #include "extensions/common/one_shot_event.h" |
| 13 | 13 |
| 14 class BrowserContextKeyedServiceFactory; | 14 class BrowserContextKeyedServiceFactory; |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class FilePath; | 17 class FilePath; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 class BrowserContext; | 21 class BrowserContext; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace extensions { | 24 namespace extensions { |
| 25 | 25 |
| 26 class DeclarativeUserScriptMaster; |
| 26 class EventRouter; | 27 class EventRouter; |
| 27 class InfoMap; | 28 class InfoMap; |
| 28 class LazyBackgroundTaskQueue; | 29 class LazyBackgroundTaskQueue; |
| 29 class ProcessManager; | 30 class ProcessManager; |
| 30 class RendererStartupHelper; | 31 class RendererStartupHelper; |
| 32 class SharedUserScriptMaster; |
| 31 | 33 |
| 32 // A simplified version of ExtensionSystem for app_shell. Allows | 34 // A simplified version of ExtensionSystem for app_shell. Allows |
| 33 // app_shell to skip initialization of services it doesn't need. | 35 // app_shell to skip initialization of services it doesn't need. |
| 34 class ShellExtensionSystem : public ExtensionSystem { | 36 class ShellExtensionSystem : public ExtensionSystem { |
| 35 public: | 37 public: |
| 36 explicit ShellExtensionSystem(content::BrowserContext* browser_context); | 38 explicit ShellExtensionSystem(content::BrowserContext* browser_context); |
| 37 virtual ~ShellExtensionSystem(); | 39 virtual ~ShellExtensionSystem(); |
| 38 | 40 |
| 39 // Loads an unpacked application from a directory. Returns true on success. | 41 // Loads an unpacked application from a directory. Returns true on success. |
| 40 bool LoadApp(const base::FilePath& app_dir); | 42 bool LoadApp(const base::FilePath& app_dir); |
| 41 | 43 |
| 42 // Launch the currently loaded app. | 44 // Launch the currently loaded app. |
| 43 void LaunchApp(); | 45 void LaunchApp(); |
| 44 | 46 |
| 45 // KeyedService implementation: | 47 // KeyedService implementation: |
| 46 virtual void Shutdown() OVERRIDE; | 48 virtual void Shutdown() OVERRIDE; |
| 47 | 49 |
| 48 scoped_refptr<Extension> extension() { return extension_; } | 50 scoped_refptr<Extension> extension() { return extension_; } |
| 49 | 51 |
| 50 // ExtensionSystem implementation: | 52 // ExtensionSystem implementation: |
| 51 virtual void InitForRegularProfile(bool extensions_enabled) OVERRIDE; | 53 virtual void InitForRegularProfile(bool extensions_enabled) OVERRIDE; |
| 52 virtual ExtensionService* extension_service() OVERRIDE; | 54 virtual ExtensionService* extension_service() OVERRIDE; |
| 53 virtual RuntimeData* runtime_data() OVERRIDE; | 55 virtual RuntimeData* runtime_data() OVERRIDE; |
| 54 virtual ManagementPolicy* management_policy() OVERRIDE; | 56 virtual ManagementPolicy* management_policy() OVERRIDE; |
| 55 virtual UserScriptMaster* user_script_master() OVERRIDE; | 57 virtual SharedUserScriptMaster* shared_user_script_master() OVERRIDE; |
| 56 virtual ProcessManager* process_manager() OVERRIDE; | 58 virtual ProcessManager* process_manager() OVERRIDE; |
| 57 virtual StateStore* state_store() OVERRIDE; | 59 virtual StateStore* state_store() OVERRIDE; |
| 58 virtual StateStore* rules_store() OVERRIDE; | 60 virtual StateStore* rules_store() OVERRIDE; |
| 59 virtual InfoMap* info_map() OVERRIDE; | 61 virtual InfoMap* info_map() OVERRIDE; |
| 60 virtual LazyBackgroundTaskQueue* lazy_background_task_queue() OVERRIDE; | 62 virtual LazyBackgroundTaskQueue* lazy_background_task_queue() OVERRIDE; |
| 61 virtual EventRouter* event_router() OVERRIDE; | 63 virtual EventRouter* event_router() OVERRIDE; |
| 62 virtual ExtensionWarningService* warning_service() OVERRIDE; | 64 virtual ExtensionWarningService* warning_service() OVERRIDE; |
| 63 virtual Blacklist* blacklist() OVERRIDE; | 65 virtual Blacklist* blacklist() OVERRIDE; |
| 64 virtual ErrorConsole* error_console() OVERRIDE; | 66 virtual ErrorConsole* error_console() OVERRIDE; |
| 65 virtual InstallVerifier* install_verifier() OVERRIDE; | 67 virtual InstallVerifier* install_verifier() OVERRIDE; |
| 66 virtual QuotaService* quota_service() OVERRIDE; | 68 virtual QuotaService* quota_service() OVERRIDE; |
| 67 virtual void RegisterExtensionWithRequestContexts( | 69 virtual void RegisterExtensionWithRequestContexts( |
| 68 const Extension* extension) OVERRIDE; | 70 const Extension* extension) OVERRIDE; |
| 69 virtual void UnregisterExtensionWithRequestContexts( | 71 virtual void UnregisterExtensionWithRequestContexts( |
| 70 const std::string& extension_id, | 72 const std::string& extension_id, |
| 71 const UnloadedExtensionInfo::Reason reason) OVERRIDE; | 73 const UnloadedExtensionInfo::Reason reason) OVERRIDE; |
| 72 virtual const OneShotEvent& ready() const OVERRIDE; | 74 virtual const OneShotEvent& ready() const OVERRIDE; |
| 73 virtual ContentVerifier* content_verifier() OVERRIDE; | 75 virtual ContentVerifier* content_verifier() OVERRIDE; |
| 74 virtual scoped_ptr<ExtensionSet> GetDependentExtensions( | 76 virtual scoped_ptr<ExtensionSet> GetDependentExtensions( |
| 75 const Extension* extension) OVERRIDE; | 77 const Extension* extension) OVERRIDE; |
| 78 virtual DeclarativeUserScriptMaster* |
| 79 GetDeclarativeUserScriptMasterByExtension( |
| 80 const ExtensionId& extension_id) OVERRIDE; |
| 76 | 81 |
| 77 private: | 82 private: |
| 78 content::BrowserContext* browser_context_; // Not owned. | 83 content::BrowserContext* browser_context_; // Not owned. |
| 79 | 84 |
| 80 // Extension ID for the app. | 85 // Extension ID for the app. |
| 81 std::string app_id_; | 86 std::string app_id_; |
| 82 | 87 |
| 83 scoped_refptr<Extension> extension_; | 88 scoped_refptr<Extension> extension_; |
| 84 | 89 |
| 85 // Data to be accessed on the IO thread. Must outlive process_manager_. | 90 // Data to be accessed on the IO thread. Must outlive process_manager_. |
| 86 scoped_refptr<InfoMap> info_map_; | 91 scoped_refptr<InfoMap> info_map_; |
| 87 | 92 |
| 88 scoped_ptr<RuntimeData> runtime_data_; | 93 scoped_ptr<RuntimeData> runtime_data_; |
| 89 scoped_ptr<LazyBackgroundTaskQueue> lazy_background_task_queue_; | 94 scoped_ptr<LazyBackgroundTaskQueue> lazy_background_task_queue_; |
| 90 scoped_ptr<EventRouter> event_router_; | 95 scoped_ptr<EventRouter> event_router_; |
| 91 scoped_ptr<ProcessManager> process_manager_; | 96 scoped_ptr<ProcessManager> process_manager_; |
| 92 scoped_ptr<QuotaService> quota_service_; | 97 scoped_ptr<QuotaService> quota_service_; |
| 93 | 98 |
| 94 // Signaled when the extension system has completed its startup tasks. | 99 // Signaled when the extension system has completed its startup tasks. |
| 95 OneShotEvent ready_; | 100 OneShotEvent ready_; |
| 96 | 101 |
| 97 DISALLOW_COPY_AND_ASSIGN(ShellExtensionSystem); | 102 DISALLOW_COPY_AND_ASSIGN(ShellExtensionSystem); |
| 98 }; | 103 }; |
| 99 | 104 |
| 100 } // namespace extensions | 105 } // namespace extensions |
| 101 | 106 |
| 102 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_ | 107 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_EXTENSION_SYSTEM_H_ |
| OLD | NEW |