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

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

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again, previous had unrelated broken win_rel test. Created 8 years 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 (c) 2012 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_COMPONENT_LOADER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_
6 #define CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/prefs/public/pref_change_registrar.h" 13 #include "base/prefs/public/pref_change_registrar.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 15
16 class ExtensionServiceInterface; 16 class ExtensionServiceInterface;
17 class PrefService; 17 class PrefServiceBase;
18 class PrefServiceSyncable;
18 19
19 namespace extensions { 20 namespace extensions {
20 21
21 class Extension; 22 class Extension;
22 23
23 // For registering, loading, and unloading component extensions. 24 // For registering, loading, and unloading component extensions.
24 class ComponentLoader { 25 class ComponentLoader {
25 public: 26 public:
26 ComponentLoader(ExtensionServiceInterface* extension_service, 27 ComponentLoader(ExtensionServiceInterface* extension_service,
27 PrefService* prefs, 28 PrefServiceBase* prefs,
28 PrefService* local_state); 29 PrefServiceBase* local_state);
29 virtual ~ComponentLoader(); 30 virtual ~ComponentLoader();
30 31
31 size_t registered_extensions_count() const { 32 size_t registered_extensions_count() const {
32 return component_extensions_.size(); 33 return component_extensions_.size();
33 } 34 }
34 35
35 // Creates and loads all registered component extensions, including those with 36 // Creates and loads all registered component extensions, including those with
36 // background pages. 37 // background pages.
37 void BulkLoadAll(); 38 void BulkLoadAll();
38 39
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // Call this during test setup to load component extensions that have 82 // Call this during test setup to load component extensions that have
82 // background pages for testing, which could otherwise interfere with tests. 83 // background pages for testing, which could otherwise interfere with tests.
83 static void EnableBackgroundExtensionsForTesting(); 84 static void EnableBackgroundExtensionsForTesting();
84 85
85 // Adds the default component extensions. If |skip_session_components| 86 // Adds the default component extensions. If |skip_session_components|
86 // the loader will skip loading component extensions that weren't supposed to 87 // the loader will skip loading component extensions that weren't supposed to
87 // be loaded unless we are in signed user session (ChromeOS). For all other 88 // be loaded unless we are in signed user session (ChromeOS). For all other
88 // platforms this |skip_session_components| is expected to be unset. 89 // platforms this |skip_session_components| is expected to be unset.
89 void AddDefaultComponentExtensions(bool skip_session_components); 90 void AddDefaultComponentExtensions(bool skip_session_components);
90 91
91 static void RegisterUserPrefs(PrefService* prefs); 92 static void RegisterUserPrefs(PrefServiceSyncable* prefs);
92 93
93 // Parse the given JSON manifest. Returns NULL if it cannot be parsed, or if 94 // Parse the given JSON manifest. Returns NULL if it cannot be parsed, or if
94 // if the result is not a DictionaryValue. 95 // if the result is not a DictionaryValue.
95 DictionaryValue* ParseManifest(const std::string& manifest_contents) const; 96 DictionaryValue* ParseManifest(const std::string& manifest_contents) const;
96 97
97 // Clear the list of registered extensions. 98 // Clear the list of registered extensions.
98 void ClearAllRegistered(); 99 void ClearAllRegistered();
99 100
100 // Reloads a registered component extension. 101 // Reloads a registered component extension.
101 void Reload(const std::string& extension_id); 102 void Reload(const std::string& extension_id);
(...skipping 30 matching lines...) Expand all
132 #endif 133 #endif
133 134
134 // Add the enterprise webstore extension, or reload it if already loaded. 135 // Add the enterprise webstore extension, or reload it if already loaded.
135 void AddOrReloadEnterpriseWebStore(); 136 void AddOrReloadEnterpriseWebStore();
136 137
137 void AddChromeApp(); 138 void AddChromeApp();
138 139
139 // Unloads |component| from the memory. 140 // Unloads |component| from the memory.
140 void UnloadComponent(ComponentExtensionInfo* component); 141 void UnloadComponent(ComponentExtensionInfo* component);
141 142
142 PrefService* prefs_; 143 PrefServiceBase* profile_prefs_;
143 PrefService* local_state_; 144 PrefServiceBase* local_state_;
144 145
145 ExtensionServiceInterface* extension_service_; 146 ExtensionServiceInterface* extension_service_;
146 147
147 // List of registered component extensions (see Extension::Location). 148 // List of registered component extensions (see Extension::Location).
148 typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions; 149 typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions;
149 RegisteredComponentExtensions component_extensions_; 150 RegisteredComponentExtensions component_extensions_;
150 151
151 PrefChangeRegistrar pref_change_registrar_; 152 PrefChangeRegistrar pref_change_registrar_;
152 153
153 // Extensions with background pages deferred by LoadAll(true). 154 // Extensions with background pages deferred by LoadAll(true).
154 typedef std::vector<scoped_refptr<const Extension> > DeferredAtLoadExtensions; 155 typedef std::vector<scoped_refptr<const Extension> > DeferredAtLoadExtensions;
155 DeferredAtLoadExtensions deferred_at_load_extensions; 156 DeferredAtLoadExtensions deferred_at_load_extensions;
156 157
157 DISALLOW_COPY_AND_ASSIGN(ComponentLoader); 158 DISALLOW_COPY_AND_ASSIGN(ComponentLoader);
158 }; 159 };
159 160
160 } // namespace extensions 161 } // namespace extensions
161 162
162 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ 163 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/app_notify_channel_setup_unittest.cc ('k') | chrome/browser/extensions/component_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698