Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: chrome/browser/extensions/extension_system_impl.h

Issue 147923005: Split ExtensionSystem interface from ExtensionSystemImpl implementation, part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re^3base Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_IMPL_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_IMPL_H_
7 7
8 #include <string> 8 #include "extensions/browser/extension_system.h"
9
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
13 #include "extensions/common/extension.h"
14 #include "extensions/common/one_shot_event.h" 9 #include "extensions/common/one_shot_event.h"
15 10
16 class ExtensionService;
17 class Profile; 11 class Profile;
18 12
19 #if defined(OS_CHROMEOS) 13 namespace extensions {
20 namespace chromeos {
21 class DeviceLocalAccountManagementPolicyProvider;
22 }
23 #endif // defined(OS_CHROMEOS)
24 14
25 namespace content {
26 class BrowserContext;
27 }
28
29 namespace extensions {
30 class Blacklist;
31 class ErrorConsole;
32 class EventRouter;
33 class Extension;
34 class ExtensionSystemSharedFactory; 15 class ExtensionSystemSharedFactory;
35 class ExtensionWarningBadgeService; 16 class ExtensionWarningBadgeService;
36 class ExtensionWarningService;
37 class InfoMap;
38 class InstallVerifier;
39 class LazyBackgroundTaskQueue;
40 class ManagementPolicy;
41 class NavigationObserver; 17 class NavigationObserver;
42 class ProcessManager;
43 class RuntimeData;
44 class StandardManagementPolicyProvider; 18 class StandardManagementPolicyProvider;
45 class StateStore;
46 class UserScriptMaster;
47
48 // The ExtensionSystem manages the creation and destruction of services
49 // related to extensions. Most objects are shared between normal
50 // and incognito Profiles, except as called out in comments.
51 // This interface supports using TestExtensionSystem for TestingProfiles
52 // that don't want all of the extensions baggage in their tests.
53 class ExtensionSystem : public BrowserContextKeyedService {
54 public:
55 ExtensionSystem();
56 virtual ~ExtensionSystem();
57
58 // Returns the instance for the given profile, or NULL if none. This is
59 // a convenience wrapper around ExtensionSystemFactory::GetForProfile.
60 static ExtensionSystem* Get(Profile* profile);
61
62 // Returns the same instance as Get() above.
63 static ExtensionSystem* GetForBrowserContext(
64 content::BrowserContext* profile);
65
66 // BrowserContextKeyedService implementation.
67 virtual void Shutdown() OVERRIDE {}
68
69 // Initializes extensions machinery.
70 // Component extensions are always enabled, external and user extensions are
71 // controlled by |extensions_enabled|.
72 virtual void InitForRegularProfile(bool extensions_enabled) = 0;
73
74 // The ExtensionService is created at startup.
75 virtual ExtensionService* extension_service() = 0;
76
77 // Per-extension data that can change during the life of the process but
78 // does not persist across restarts. Lives on UI thread. Created at startup.
79 virtual RuntimeData* runtime_data() = 0;
80
81 // The class controlling whether users are permitted to perform certain
82 // actions on extensions (install, uninstall, disable, etc.).
83 // The ManagementPolicy is created at startup.
84 virtual ManagementPolicy* management_policy() = 0;
85
86 // The UserScriptMaster is created at startup.
87 virtual UserScriptMaster* user_script_master() = 0;
88
89 // The ProcessManager is created at startup.
90 virtual ProcessManager* process_manager() = 0;
91
92 // The StateStore is created at startup.
93 virtual StateStore* state_store() = 0;
94
95 // The rules store is created at startup.
96 virtual StateStore* rules_store() = 0;
97
98 // Returns the IO-thread-accessible extension data.
99 virtual InfoMap* info_map() = 0;
100
101 // The LazyBackgroundTaskQueue is created at startup.
102 virtual LazyBackgroundTaskQueue* lazy_background_task_queue() = 0;
103
104 // The EventRouter is created at startup.
105 virtual EventRouter* event_router() = 0;
106
107 // The ExtensionWarningService is created at startup.
108 virtual ExtensionWarningService* warning_service() = 0;
109
110 // The blacklist is created at startup.
111 virtual Blacklist* blacklist() = 0;
112
113 // The ErrorConsole is created at startup.
114 virtual ErrorConsole* error_console() = 0;
115
116 // The InstallVerifier is created at startup.
117 virtual InstallVerifier* install_verifier() = 0;
118
119 // Called by the ExtensionService that lives in this system. Gives the
120 // info map a chance to react to the load event before the EXTENSION_LOADED
121 // notification has fired. The purpose for handling this event first is to
122 // avoid race conditions by making sure URLRequestContexts learn about new
123 // extensions before anything else needs them to know.
124 virtual void RegisterExtensionWithRequestContexts(
125 const Extension* extension) {}
126
127 // Called by the ExtensionService that lives in this system. Lets the
128 // info map clean up its RequestContexts once all the listeners to the
129 // EXTENSION_UNLOADED notification have finished running.
130 virtual void UnregisterExtensionWithRequestContexts(
131 const std::string& extension_id,
132 const UnloadedExtensionInfo::Reason reason) {}
133
134 // Signaled when the extension system has completed its startup tasks.
135 virtual const OneShotEvent& ready() const = 0;
136 };
137 19
138 // The ExtensionSystem for ProfileImpl and OffTheRecordProfileImpl. 20 // The ExtensionSystem for ProfileImpl and OffTheRecordProfileImpl.
139 // Implementation details: non-shared services are owned by 21 // Implementation details: non-shared services are owned by
140 // ExtensionSystemImpl, a BrowserContextKeyedService with separate incognito 22 // ExtensionSystemImpl, a BrowserContextKeyedService with separate incognito
141 // instances. A private Shared class (also a BrowserContextKeyedService, 23 // instances. A private Shared class (also a BrowserContextKeyedService,
142 // but with a shared instance for incognito) keeps the common services. 24 // but with a shared instance for incognito) keeps the common services.
143 class ExtensionSystemImpl : public ExtensionSystem { 25 class ExtensionSystemImpl : public ExtensionSystem {
144 public: 26 public:
145 explicit ExtensionSystemImpl(Profile* profile); 27 explicit ExtensionSystemImpl(Profile* profile);
146 virtual ~ExtensionSystemImpl(); 28 virtual ~ExtensionSystemImpl();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 // |process_manager_| still lives, we handle incoming resource requests from 135 // |process_manager_| still lives, we handle incoming resource requests from
254 // extension processes and those require access to the ResourceContext owned 136 // extension processes and those require access to the ResourceContext owned
255 // by |io_data_|. 137 // by |io_data_|.
256 scoped_ptr<ProcessManager> process_manager_; 138 scoped_ptr<ProcessManager> process_manager_;
257 139
258 DISALLOW_COPY_AND_ASSIGN(ExtensionSystemImpl); 140 DISALLOW_COPY_AND_ASSIGN(ExtensionSystemImpl);
259 }; 141 };
260 142
261 } // namespace extensions 143 } // namespace extensions
262 144
263 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_H_ 145 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SYSTEM_IMPL_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_system_factory.cc ('k') | chrome/browser/extensions/extension_system_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698