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