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 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // Calls |done_cb|, if not a null callback, on success. |
103 // NOTE: |done_cb| is not called if the component loader is shut down | 103 // NOTE: |done_cb| is not called if the component loader is shut down |
104 // during loading. | 104 // during loading. |
105 void AddChromeVoxExtension(const base::Closure& done_cb); | 105 void AddChromeVoxExtension(const base::Closure& done_cb); |
106 std::string AddChromeOsSpeechSynthesisExtension(); | 106 void AddChromeOsSpeechSynthesisExtension(); |
107 #endif | 107 #endif |
108 | 108 |
109 void set_ignore_whitelist_for_testing(bool value) { | 109 void set_ignore_whitelist_for_testing(bool value) { |
110 ignore_whitelist_for_testing_ = value; | 110 ignore_whitelist_for_testing_ = value; |
111 } | 111 } |
112 | 112 |
113 private: | 113 private: |
114 // Information about a registered component extension. | 114 // Information about a registered component extension. |
115 struct ComponentExtensionInfo { | 115 struct ComponentExtensionInfo { |
116 ComponentExtensionInfo(const base::DictionaryValue* manifest, | 116 ComponentExtensionInfo(const base::DictionaryValue* manifest, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 void AddKeyboardApp(); | 157 void AddKeyboardApp(); |
158 void AddWebStoreApp(); | 158 void AddWebStoreApp(); |
159 | 159 |
160 // Unloads |component| from the memory. | 160 // Unloads |component| from the memory. |
161 void UnloadComponent(ComponentExtensionInfo* component); | 161 void UnloadComponent(ComponentExtensionInfo* component); |
162 | 162 |
163 // Enable HTML5 FileSystem for given component extension in Guest mode. | 163 // Enable HTML5 FileSystem for given component extension in Guest mode. |
164 void EnableFileSystemInGuestMode(const std::string& id); | 164 void EnableFileSystemInGuestMode(const std::string& id); |
165 | 165 |
166 #if defined(OS_CHROMEOS) | 166 #if defined(OS_CHROMEOS) |
167 // Used as a reply callback when loading the ChromeVox extension. | 167 // Adds an extension where the manifest file is stored on the file system. |
168 // Called with a |chromevox_path| and parsed |manifest| and invokes | 168 // |manifest_filename| can be relative to the |root_directory|. |
| 169 void AddWithManifestFile( |
| 170 const base::FilePath::CharType* manifest_filename, |
| 171 const base::FilePath& root_directory, |
| 172 const char* extension_id, |
| 173 const base::Closure& done_cb); |
| 174 |
| 175 // Used as a reply callback by |AddWithManifestFile|. |
| 176 // Called with a |root_directory| and parsed |manifest| and invokes |
169 // |done_cb| after adding the extension. | 177 // |done_cb| after adding the extension. |
170 void AddChromeVoxExtensionWithManifest( | 178 void FinishAddWithManifestFile( |
171 const base::FilePath& chromevox_path, | 179 const base::FilePath& root_directory, |
| 180 const char* extension_id, |
172 const base::Closure& done_cb, | 181 const base::Closure& done_cb, |
173 scoped_ptr<base::DictionaryValue> manifest); | 182 scoped_ptr<base::DictionaryValue> manifest); |
174 #endif | 183 #endif |
175 | 184 |
176 PrefService* profile_prefs_; | 185 PrefService* profile_prefs_; |
177 PrefService* local_state_; | 186 PrefService* local_state_; |
178 content::BrowserContext* browser_context_; | 187 content::BrowserContext* browser_context_; |
179 | 188 |
180 ExtensionServiceInterface* extension_service_; | 189 ExtensionServiceInterface* extension_service_; |
181 | 190 |
182 // List of registered component extensions (see Manifest::Location). | 191 // List of registered component extensions (see Manifest::Location). |
183 typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions; | 192 typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions; |
184 RegisteredComponentExtensions component_extensions_; | 193 RegisteredComponentExtensions component_extensions_; |
185 | 194 |
186 bool ignore_whitelist_for_testing_; | 195 bool ignore_whitelist_for_testing_; |
187 | 196 |
188 base::WeakPtrFactory<ComponentLoader> weak_factory_; | 197 base::WeakPtrFactory<ComponentLoader> weak_factory_; |
189 | 198 |
190 FRIEND_TEST_ALL_PREFIXES(TtsApiTest, NetworkSpeechEngine); | 199 FRIEND_TEST_ALL_PREFIXES(TtsApiTest, NetworkSpeechEngine); |
191 FRIEND_TEST_ALL_PREFIXES(TtsApiTest, NoNetworkSpeechEngineWhenOffline); | 200 FRIEND_TEST_ALL_PREFIXES(TtsApiTest, NoNetworkSpeechEngineWhenOffline); |
192 | 201 |
193 DISALLOW_COPY_AND_ASSIGN(ComponentLoader); | 202 DISALLOW_COPY_AND_ASSIGN(ComponentLoader); |
194 }; | 203 }; |
195 | 204 |
196 } // namespace extensions | 205 } // namespace extensions |
197 | 206 |
198 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ | 207 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ |
OLD | NEW |