Do not update the url text while in batch edit mode.
[chromium-blink-merge.git] / extensions / browser / extension_system.h
blob099a99fdb1a6ba07eff0bc4346e31cda9347869c
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
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_BROWSER_EXTENSION_SYSTEM_H_
6 #define EXTENSIONS_BROWSER_EXTENSION_SYSTEM_H_
8 #include <string>
10 #include "base/memory/ref_counted.h"
11 #include "components/keyed_service/core/keyed_service.h"
12 #include "extensions/common/extension.h"
14 #if !defined(ENABLE_EXTENSIONS)
15 #error "Extensions must be enabled"
16 #endif
18 class ExtensionService;
20 #if defined(OS_CHROMEOS)
21 namespace chromeos {
22 class DeviceLocalAccountManagementPolicyProvider;
24 #endif // defined(OS_CHROMEOS)
26 namespace content {
27 class BrowserContext;
30 namespace extensions {
32 class ContentVerifier;
33 class Extension;
34 class ExtensionSet;
35 class InfoMap;
36 class ManagementPolicy;
37 class OneShotEvent;
38 class QuotaService;
39 class RuntimeData;
40 class SharedUserScriptMaster;
41 class StateStore;
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 KeyedServices in
46 // their own right.
47 class ExtensionSystem : public KeyedService {
48 public:
49 ExtensionSystem();
50 ~ExtensionSystem() override;
52 // Returns the instance for the given browser context, or NULL if none.
53 static ExtensionSystem* Get(content::BrowserContext* context);
55 // Initializes extensions machinery.
56 // Component extensions are always enabled, external and user extensions are
57 // controlled by |extensions_enabled|.
58 virtual void InitForRegularProfile(bool extensions_enabled) = 0;
60 // The ExtensionService is created at startup.
61 virtual ExtensionService* extension_service() = 0;
63 // Per-extension data that can change during the life of the process but
64 // does not persist across restarts. Lives on UI thread. Created at startup.
65 virtual RuntimeData* runtime_data() = 0;
67 // The class controlling whether users are permitted to perform certain
68 // actions on extensions (install, uninstall, disable, etc.).
69 // The ManagementPolicy is created at startup.
70 virtual ManagementPolicy* management_policy() = 0;
72 // The SharedUserScriptMaster is created at startup.
73 virtual SharedUserScriptMaster* shared_user_script_master() = 0;
75 // The StateStore is created at startup.
76 virtual StateStore* state_store() = 0;
78 // The rules store is created at startup.
79 virtual StateStore* rules_store() = 0;
81 // Returns the IO-thread-accessible extension data.
82 virtual InfoMap* info_map() = 0;
84 // Returns the QuotaService that limits calls to certain extension functions.
85 // Lives on the UI thread. Created at startup.
86 virtual QuotaService* quota_service() = 0;
88 // Called by the ExtensionService that lives in this system. Gives the
89 // info map a chance to react to the load event before the EXTENSION_LOADED
90 // notification has fired. The purpose for handling this event first is to
91 // avoid race conditions by making sure URLRequestContexts learn about new
92 // extensions before anything else needs them to know.
93 virtual void RegisterExtensionWithRequestContexts(
94 const Extension* extension) {}
96 // Called by the ExtensionService that lives in this system. Lets the
97 // info map clean up its RequestContexts once all the listeners to the
98 // EXTENSION_UNLOADED notification have finished running.
99 virtual void UnregisterExtensionWithRequestContexts(
100 const std::string& extension_id,
101 const UnloadedExtensionInfo::Reason reason) {}
103 // Signaled when the extension system has completed its startup tasks.
104 virtual const OneShotEvent& ready() const = 0;
106 // Returns the content verifier, if any.
107 virtual ContentVerifier* content_verifier() = 0;
109 // Get a set of extensions that depend on the given extension.
110 // TODO(elijahtaylor): Move SharedModuleService out of chrome/browser
111 // so it can be retrieved from ExtensionSystem directly.
112 virtual scoped_ptr<ExtensionSet> GetDependentExtensions(
113 const Extension* extension) = 0;
116 } // namespace extensions
118 #endif // EXTENSIONS_BROWSER_EXTENSION_SYSTEM_H_