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