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 private: | 109 private: |
110 // Information about a registered component extension. | 110 // Information about a registered component extension. |
111 struct ComponentExtensionInfo { | 111 struct ComponentExtensionInfo { |
112 ComponentExtensionInfo(const base::DictionaryValue* manifest, | 112 ComponentExtensionInfo(const base::DictionaryValue* manifest, |
113 const base::FilePath& root_directory); | 113 const base::FilePath& root_directory); |
114 | 114 |
115 // The parsed contents of the extensions's manifest file. | 115 // The parsed contents of the extensions's manifest file. |
116 const base::DictionaryValue* manifest; | 116 const base::DictionaryValue* manifest; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 void AddKeyboardApp(); | 149 void AddKeyboardApp(); |
150 void AddWebStoreApp(); | 150 void AddWebStoreApp(); |
151 | 151 |
152 // Unloads |component| from the memory. | 152 // Unloads |component| from the memory. |
153 void UnloadComponent(ComponentExtensionInfo* component); | 153 void UnloadComponent(ComponentExtensionInfo* component); |
154 | 154 |
155 // Enable HTML5 FileSystem for given component extension in Guest mode. | 155 // Enable HTML5 FileSystem for given component extension in Guest mode. |
156 void EnableFileSystemInGuestMode(const std::string& id); | 156 void EnableFileSystemInGuestMode(const std::string& id); |
157 | 157 |
158 #if defined(OS_CHROMEOS) | 158 #if defined(OS_CHROMEOS) |
159 // Used as a reply callback when loading the ChromeVox extension. | 159 // Adds an extension where the manifest file is stored on the file system. |
160 // Called with a |chromevox_path| and parsed |manifest| and invokes | 160 // |manifest_filename| can be relative to the |root_directory|. |
| 161 void AddWithManifestFile( |
| 162 const base::FilePath::CharType* manifest_filename, |
| 163 const base::FilePath& root_directory, |
| 164 const char* extension_id, |
| 165 const base::Closure& done_cb); |
| 166 |
| 167 // Used as a reply callback by |AddWithManifestFile|. |
| 168 // Called with a |root_directory| and parsed |manifest| and invokes |
161 // |done_cb| after adding the extension. | 169 // |done_cb| after adding the extension. |
162 void AddChromeVoxExtensionWithManifest( | 170 void FinishAddWithManifestFile( |
163 const base::FilePath& chromevox_path, | 171 const base::FilePath& root_directory, |
| 172 const char* extension_id, |
164 const base::Closure& done_cb, | 173 const base::Closure& done_cb, |
165 scoped_ptr<base::DictionaryValue> manifest); | 174 scoped_ptr<base::DictionaryValue> manifest); |
166 #endif | 175 #endif |
167 | 176 |
168 PrefService* profile_prefs_; | 177 PrefService* profile_prefs_; |
169 PrefService* local_state_; | 178 PrefService* local_state_; |
170 content::BrowserContext* browser_context_; | 179 content::BrowserContext* browser_context_; |
171 | 180 |
172 ExtensionServiceInterface* extension_service_; | 181 ExtensionServiceInterface* extension_service_; |
173 | 182 |
174 // List of registered component extensions (see Manifest::Location). | 183 // List of registered component extensions (see Manifest::Location). |
175 typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions; | 184 typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions; |
176 RegisteredComponentExtensions component_extensions_; | 185 RegisteredComponentExtensions component_extensions_; |
177 | 186 |
178 base::WeakPtrFactory<ComponentLoader> weak_factory_; | 187 base::WeakPtrFactory<ComponentLoader> weak_factory_; |
179 | 188 |
180 FRIEND_TEST_ALL_PREFIXES(TtsApiTest, NetworkSpeechEngine); | 189 FRIEND_TEST_ALL_PREFIXES(TtsApiTest, NetworkSpeechEngine); |
181 FRIEND_TEST_ALL_PREFIXES(TtsApiTest, NoNetworkSpeechEngineWhenOffline); | 190 FRIEND_TEST_ALL_PREFIXES(TtsApiTest, NoNetworkSpeechEngineWhenOffline); |
182 | 191 |
183 DISALLOW_COPY_AND_ASSIGN(ComponentLoader); | 192 DISALLOW_COPY_AND_ASSIGN(ComponentLoader); |
184 }; | 193 }; |
185 | 194 |
186 } // namespace extensions | 195 } // namespace extensions |
187 | 196 |
188 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ | 197 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ |
OLD | NEW |