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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 public: | 25 public: |
| 26 ComponentLoader(ExtensionServiceInterface* extension_service, | 26 ComponentLoader(ExtensionServiceInterface* extension_service, |
| 27 PrefService* prefs, | 27 PrefService* prefs, |
| 28 PrefService* local_state); | 28 PrefService* local_state); |
| 29 virtual ~ComponentLoader(); | 29 virtual ~ComponentLoader(); |
| 30 | 30 |
| 31 size_t registered_extensions_count() const { | 31 size_t registered_extensions_count() const { |
| 32 return component_extensions_.size(); | 32 return component_extensions_.size(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 // Loads any registered component extensions. | 35 // Loads registered component extensions. Extensions with background pages |
| 36 void LoadAll(); | 36 // will be deferred until LoadDeferred if the argument is true. |
|
Yoyo Zhou
2012/12/19 21:50:38
LoadAllDeferred
tapted
2012/12/19 22:58:24
Done.
| |
| 37 void LoadAll(bool defer_extensions_with_background_pages); | |
|
Yoyo Zhou
2012/12/19 21:50:38
Reading LoadAll(false) in the code isn't very self
tapted
2012/12/19 22:58:24
Done. I went with
- BulkLoadAll
- BulkLoadDeferBac
| |
| 38 | |
| 39 // Load component extensions deferred in the last call to LoadAll(true). | |
| 40 void LoadAllDeferred(); | |
| 37 | 41 |
| 38 // Clear the list of all registered extensions and unloads them from the | 42 // Clear the list of all registered extensions and unloads them from the |
| 39 // extension service. | 43 // extension service. |
| 40 void RemoveAll(); | 44 void RemoveAll(); |
| 41 | 45 |
| 42 // Registers and possibly loads a component extension. If ExtensionService | 46 // Registers and possibly loads a component extension. If ExtensionService |
| 43 // has been initialized, the extension is loaded; otherwise, the load is | 47 // has been initialized, the extension is loaded; otherwise, the load is |
| 44 // deferred until LoadAll is called. The ID of the added extension is | 48 // deferred until LoadAll is called. The ID of the added extension is |
| 45 // returned. | 49 // returned. |
| 46 // | 50 // |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 FilePath root_directory; | 108 FilePath root_directory; |
| 105 | 109 |
| 106 // The component extension's ID. | 110 // The component extension's ID. |
| 107 std::string extension_id; | 111 std::string extension_id; |
| 108 }; | 112 }; |
| 109 | 113 |
| 110 std::string Add(const DictionaryValue* parsed_manifest, | 114 std::string Add(const DictionaryValue* parsed_manifest, |
| 111 const FilePath& root_directory); | 115 const FilePath& root_directory); |
| 112 | 116 |
| 113 // Loads a registered component extension. | 117 // Loads a registered component extension. |
| 114 const Extension* Load(const ComponentExtensionInfo& info); | 118 void Load(const ComponentExtensionInfo& info, |
|
tapted
2012/12/19 13:19:14
(note: return type changed to void - nothing used
| |
| 119 bool defer_if_has_background_page); | |
| 115 | 120 |
| 116 void AddDefaultComponentExtensionsWithBackgroundPages( | 121 void AddDefaultComponentExtensionsWithBackgroundPages( |
| 117 bool skip_session_components); | 122 bool skip_session_components); |
| 118 void AddFileManagerExtension(); | 123 void AddFileManagerExtension(); |
| 119 | 124 |
| 120 #if defined(OS_CHROMEOS) | 125 #if defined(OS_CHROMEOS) |
| 121 void AddGaiaAuthExtension(); | 126 void AddGaiaAuthExtension(); |
| 122 #endif | 127 #endif |
| 123 | 128 |
| 124 // Add the enterprise webstore extension, or reload it if already loaded. | 129 // Add the enterprise webstore extension, or reload it if already loaded. |
| 125 void AddOrReloadEnterpriseWebStore(); | 130 void AddOrReloadEnterpriseWebStore(); |
| 126 | 131 |
| 127 void AddChromeApp(); | 132 void AddChromeApp(); |
| 128 | 133 |
| 129 // Unloads |component| from the memory. | 134 // Unloads |component| from the memory. |
| 130 void UnloadComponent(ComponentExtensionInfo* component); | 135 void UnloadComponent(ComponentExtensionInfo* component); |
| 131 | 136 |
| 132 PrefService* prefs_; | 137 PrefService* prefs_; |
| 133 PrefService* local_state_; | 138 PrefService* local_state_; |
| 134 | 139 |
| 135 ExtensionServiceInterface* extension_service_; | 140 ExtensionServiceInterface* extension_service_; |
| 136 | 141 |
| 137 // List of registered component extensions (see Extension::Location). | 142 // List of registered component extensions (see Extension::Location). |
| 138 typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions; | 143 typedef std::vector<ComponentExtensionInfo> RegisteredComponentExtensions; |
| 139 RegisteredComponentExtensions component_extensions_; | 144 RegisteredComponentExtensions component_extensions_; |
| 140 | 145 |
| 141 PrefChangeRegistrar pref_change_registrar_; | 146 PrefChangeRegistrar pref_change_registrar_; |
| 142 | 147 |
| 148 // Extensions with background pages deferred by LoadAll(true). | |
| 149 typedef std::vector<scoped_refptr<const Extension> > DeferredAtLoadExtensions; | |
| 150 DeferredAtLoadExtensions deferred_at_load_extensions; | |
| 151 | |
| 143 DISALLOW_COPY_AND_ASSIGN(ComponentLoader); | 152 DISALLOW_COPY_AND_ASSIGN(ComponentLoader); |
| 144 }; | 153 }; |
| 145 | 154 |
| 146 } // namespace extensions | 155 } // namespace extensions |
| 147 | 156 |
| 148 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ | 157 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ |
| OLD | NEW |