OLD | NEW |
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 PrefServiceBase; | 17 class PrefServiceBase; |
18 class PrefServiceSyncable; | 18 class PrefRegistrySyncable; |
19 | 19 |
20 namespace extensions { | 20 namespace extensions { |
21 | 21 |
22 class Extension; | 22 class Extension; |
23 | 23 |
24 // For registering, loading, and unloading component extensions. | 24 // For registering, loading, and unloading component extensions. |
25 class ComponentLoader { | 25 class ComponentLoader { |
26 public: | 26 public: |
27 ComponentLoader(ExtensionServiceInterface* extension_service, | 27 ComponentLoader(ExtensionServiceInterface* extension_service, |
28 PrefServiceBase* prefs, | 28 PrefServiceBase* prefs, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // Call this during test setup to load component extensions that have | 73 // Call this during test setup to load component extensions that have |
74 // background pages for testing, which could otherwise interfere with tests. | 74 // background pages for testing, which could otherwise interfere with tests. |
75 static void EnableBackgroundExtensionsForTesting(); | 75 static void EnableBackgroundExtensionsForTesting(); |
76 | 76 |
77 // Adds the default component extensions. If |skip_session_components| | 77 // Adds the default component extensions. If |skip_session_components| |
78 // the loader will skip loading component extensions that weren't supposed to | 78 // the loader will skip loading component extensions that weren't supposed to |
79 // be loaded unless we are in signed user session (ChromeOS). For all other | 79 // be loaded unless we are in signed user session (ChromeOS). For all other |
80 // platforms this |skip_session_components| is expected to be unset. | 80 // platforms this |skip_session_components| is expected to be unset. |
81 void AddDefaultComponentExtensions(bool skip_session_components); | 81 void AddDefaultComponentExtensions(bool skip_session_components); |
82 | 82 |
83 static void RegisterUserPrefs(PrefServiceSyncable* prefs); | 83 static void RegisterUserPrefs(PrefRegistrySyncable* registry); |
84 | 84 |
85 // Parse the given JSON manifest. Returns NULL if it cannot be parsed, or if | 85 // Parse the given JSON manifest. Returns NULL if it cannot be parsed, or if |
86 // if the result is not a DictionaryValue. | 86 // if the result is not a DictionaryValue. |
87 DictionaryValue* ParseManifest(const std::string& manifest_contents) const; | 87 DictionaryValue* ParseManifest(const std::string& manifest_contents) const; |
88 | 88 |
89 // Clear the list of registered extensions. | 89 // Clear the list of registered extensions. |
90 void ClearAllRegistered(); | 90 void ClearAllRegistered(); |
91 | 91 |
92 // Reloads a registered component extension. | 92 // Reloads a registered component extension. |
93 void Reload(const std::string& extension_id); | 93 void Reload(const std::string& extension_id); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 RegisteredComponentExtensions component_extensions_; | 140 RegisteredComponentExtensions component_extensions_; |
141 | 141 |
142 PrefChangeRegistrar pref_change_registrar_; | 142 PrefChangeRegistrar pref_change_registrar_; |
143 | 143 |
144 DISALLOW_COPY_AND_ASSIGN(ComponentLoader); | 144 DISALLOW_COPY_AND_ASSIGN(ComponentLoader); |
145 }; | 145 }; |
146 | 146 |
147 } // namespace extensions | 147 } // namespace extensions |
148 | 148 |
149 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ | 149 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ |
OLD | NEW |