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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // Similar to above but adds the default component extensions for kiosk mode. | 92 // Similar to above but adds the default component extensions for kiosk mode. |
93 void AddDefaultComponentExtensionsForKioskMode(bool skip_session_components); | 93 void AddDefaultComponentExtensionsForKioskMode(bool skip_session_components); |
94 | 94 |
95 // Clear the list of registered extensions. | 95 // Clear the list of registered extensions. |
96 void ClearAllRegistered(); | 96 void ClearAllRegistered(); |
97 | 97 |
98 // Reloads a registered component extension. | 98 // Reloads a registered component extension. |
99 void Reload(const std::string& extension_id); | 99 void Reload(const std::string& extension_id); |
100 | 100 |
101 #if defined(OS_CHROMEOS) | 101 #if defined(OS_CHROMEOS) |
102 // Calls |done_cb|, if not a null callback, on success. | 102 // Add a component extension from a specific directory. Assumes that the |
103 // NOTE: |done_cb| is not called if the component loader is shut down | 103 // extension uses a different manifest file when this is a guest session |
104 // during loading. | 104 // and that the manifest file lives in |root_directory|. Calls |done_cb| |
105 void AddChromeVoxExtension(const base::Closure& done_cb); | 105 // on success, unless the component loader is shut down during loading. |
| 106 void AddComponentFromDir( |
| 107 const base::FilePath& root_directory, |
| 108 const char* extension_id, |
| 109 const base::Closure& done_cb); |
| 110 |
106 void AddChromeOsSpeechSynthesisExtension(); | 111 void AddChromeOsSpeechSynthesisExtension(); |
107 #endif | 112 #endif |
108 | 113 |
109 void set_ignore_whitelist_for_testing(bool value) { | 114 void set_ignore_whitelist_for_testing(bool value) { |
110 ignore_whitelist_for_testing_ = value; | 115 ignore_whitelist_for_testing_ = value; |
111 } | 116 } |
112 | 117 |
113 private: | 118 private: |
114 FRIEND_TEST_ALL_PREFIXES(ComponentLoaderTest, ParseManifest); | 119 FRIEND_TEST_ALL_PREFIXES(ComponentLoaderTest, ParseManifest); |
115 | 120 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 scoped_refptr<const Extension> CreateExtension( | 173 scoped_refptr<const Extension> CreateExtension( |
169 const ComponentExtensionInfo& info, std::string* utf8_error); | 174 const ComponentExtensionInfo& info, std::string* utf8_error); |
170 | 175 |
171 // Unloads |component| from the memory. | 176 // Unloads |component| from the memory. |
172 void UnloadComponent(ComponentExtensionInfo* component); | 177 void UnloadComponent(ComponentExtensionInfo* component); |
173 | 178 |
174 // Enable HTML5 FileSystem for given component extension in Guest mode. | 179 // Enable HTML5 FileSystem for given component extension in Guest mode. |
175 void EnableFileSystemInGuestMode(const std::string& id); | 180 void EnableFileSystemInGuestMode(const std::string& id); |
176 | 181 |
177 #if defined(OS_CHROMEOS) | 182 #if defined(OS_CHROMEOS) |
178 // Adds an extension where the manifest file is stored on the file system. | 183 // Used as a reply callback by |AddComponentFromDir|. |
179 // |manifest_filename| can be relative to the |root_directory|. | |
180 void AddWithManifestFile( | |
181 const base::FilePath::CharType* manifest_filename, | |
182 const base::FilePath& root_directory, | |
183 const char* extension_id, | |
184 const base::Closure& done_cb); | |
185 | |
186 // Used as a reply callback by |AddWithManifestFile|. | |
187 // Called with a |root_directory| and parsed |manifest| and invokes | 184 // Called with a |root_directory| and parsed |manifest| and invokes |
188 // |done_cb| after adding the extension. | 185 // |done_cb| after adding the extension. |
189 void FinishAddWithManifestFile( | 186 void FinishAddComponentFromDir( |
190 const base::FilePath& root_directory, | 187 const base::FilePath& root_directory, |
191 const char* extension_id, | 188 const char* extension_id, |
192 const base::Closure& done_cb, | 189 const base::Closure& done_cb, |
193 std::unique_ptr<base::DictionaryValue> manifest); | 190 std::unique_ptr<base::DictionaryValue> manifest); |
194 #endif | 191 #endif |
195 | 192 |
196 PrefService* profile_prefs_; | 193 PrefService* profile_prefs_; |
197 PrefService* local_state_; | 194 PrefService* local_state_; |
198 Profile* profile_; | 195 Profile* profile_; |
199 | 196 |
200 ExtensionServiceInterface* extension_service_; | 197 ExtensionServiceInterface* extension_service_; |
201 | 198 |
202 // List of registered component extensions (see Manifest::Location). | 199 // List of registered component extensions (see Manifest::Location). |
203 typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions; | 200 typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions; |
204 RegisteredComponentExtensions component_extensions_; | 201 RegisteredComponentExtensions component_extensions_; |
205 | 202 |
206 bool ignore_whitelist_for_testing_; | 203 bool ignore_whitelist_for_testing_; |
207 | 204 |
208 base::WeakPtrFactory<ComponentLoader> weak_factory_; | 205 base::WeakPtrFactory<ComponentLoader> weak_factory_; |
209 | 206 |
210 friend class TtsApiTest; | 207 friend class TtsApiTest; |
211 | 208 |
212 DISALLOW_COPY_AND_ASSIGN(ComponentLoader); | 209 DISALLOW_COPY_AND_ASSIGN(ComponentLoader); |
213 }; | 210 }; |
214 | 211 |
215 } // namespace extensions | 212 } // namespace extensions |
216 | 213 |
217 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ | 214 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ |
OLD | NEW |