OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_SYSTEM_H_ |
| 6 #define EXTENSIONS_BROWSER_EXTENSION_SYSTEM_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/memory/ref_counted.h" |
| 11 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
| 12 #include "extensions/common/extension.h" |
| 13 |
| 14 class ExtensionService; |
| 15 |
| 16 #if defined(OS_CHROMEOS) |
| 17 namespace chromeos { |
| 18 class DeviceLocalAccountManagementPolicyProvider; |
| 19 } |
| 20 #endif // defined(OS_CHROMEOS) |
| 21 |
| 22 namespace content { |
| 23 class BrowserContext; |
| 24 } |
| 25 |
| 26 namespace extensions { |
| 27 |
| 28 class Blacklist; |
| 29 class ErrorConsole; |
| 30 class EventRouter; |
| 31 class Extension; |
| 32 class ExtensionWarningService; |
| 33 class InfoMap; |
| 34 class InstallVerifier; |
| 35 class LazyBackgroundTaskQueue; |
| 36 class ManagementPolicy; |
| 37 class OneShotEvent; |
| 38 class ProcessManager; |
| 39 class RuntimeData; |
| 40 class StateStore; |
| 41 class UserScriptMaster; |
| 42 |
| 43 // ExtensionSystem manages the lifetime of many of the services used by the |
| 44 // extensions and apps system, and it handles startup and shutdown as needed. |
| 45 // Eventually, we'd like to make more of these services into |
| 46 // BrowserContextKeyedServices in their own right. |
| 47 class ExtensionSystem : public BrowserContextKeyedService { |
| 48 public: |
| 49 ExtensionSystem(); |
| 50 virtual ~ExtensionSystem(); |
| 51 |
| 52 // Returns the instance for the given browser context, or NULL if none. |
| 53 // A convenience wrapper around ExtensionSystemFactory::GetForBrowserContext. |
| 54 static ExtensionSystem* Get(content::BrowserContext* context); |
| 55 |
| 56 // Initializes extensions machinery. |
| 57 // Component extensions are always enabled, external and user extensions are |
| 58 // controlled by |extensions_enabled|. |
| 59 virtual void InitForRegularProfile(bool extensions_enabled) = 0; |
| 60 |
| 61 // The ExtensionService is created at startup. |
| 62 virtual ExtensionService* extension_service() = 0; |
| 63 |
| 64 // Per-extension data that can change during the life of the process but |
| 65 // does not persist across restarts. Lives on UI thread. Created at startup. |
| 66 virtual RuntimeData* runtime_data() = 0; |
| 67 |
| 68 // The class controlling whether users are permitted to perform certain |
| 69 // actions on extensions (install, uninstall, disable, etc.). |
| 70 // The ManagementPolicy is created at startup. |
| 71 virtual ManagementPolicy* management_policy() = 0; |
| 72 |
| 73 // The UserScriptMaster is created at startup. |
| 74 virtual UserScriptMaster* user_script_master() = 0; |
| 75 |
| 76 // The ProcessManager is created at startup. |
| 77 virtual ProcessManager* process_manager() = 0; |
| 78 |
| 79 // The StateStore is created at startup. |
| 80 virtual StateStore* state_store() = 0; |
| 81 |
| 82 // The rules store is created at startup. |
| 83 virtual StateStore* rules_store() = 0; |
| 84 |
| 85 // Returns the IO-thread-accessible extension data. |
| 86 virtual InfoMap* info_map() = 0; |
| 87 |
| 88 // The LazyBackgroundTaskQueue is created at startup. |
| 89 virtual LazyBackgroundTaskQueue* lazy_background_task_queue() = 0; |
| 90 |
| 91 // The EventRouter is created at startup. |
| 92 virtual EventRouter* event_router() = 0; |
| 93 |
| 94 // The ExtensionWarningService is created at startup. |
| 95 virtual ExtensionWarningService* warning_service() = 0; |
| 96 |
| 97 // The blacklist is created at startup. |
| 98 virtual Blacklist* blacklist() = 0; |
| 99 |
| 100 // The ErrorConsole is created at startup. |
| 101 virtual ErrorConsole* error_console() = 0; |
| 102 |
| 103 // The InstallVerifier is created at startup. |
| 104 virtual InstallVerifier* install_verifier() = 0; |
| 105 |
| 106 // Called by the ExtensionService that lives in this system. Gives the |
| 107 // info map a chance to react to the load event before the EXTENSION_LOADED |
| 108 // notification has fired. The purpose for handling this event first is to |
| 109 // avoid race conditions by making sure URLRequestContexts learn about new |
| 110 // extensions before anything else needs them to know. |
| 111 virtual void RegisterExtensionWithRequestContexts( |
| 112 const Extension* extension) {} |
| 113 |
| 114 // Called by the ExtensionService that lives in this system. Lets the |
| 115 // info map clean up its RequestContexts once all the listeners to the |
| 116 // EXTENSION_UNLOADED notification have finished running. |
| 117 virtual void UnregisterExtensionWithRequestContexts( |
| 118 const std::string& extension_id, |
| 119 const UnloadedExtensionInfo::Reason reason) {} |
| 120 |
| 121 // Signaled when the extension system has completed its startup tasks. |
| 122 virtual const OneShotEvent& ready() const = 0; |
| 123 }; |
| 124 |
| 125 } // namespace extensions |
| 126 |
| 127 #endif // EXTENSIONS_BROWSER_EXTENSION_SYSTEM_H_ |
OLD | NEW |