| 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 |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/prefs/pref_change_registrar.h" | 13 #include "base/prefs/pref_change_registrar.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 | 15 |
| 16 class ExtensionServiceInterface; | 16 class ExtensionServiceInterface; |
| 17 class PrefService; | 17 class PrefService; |
| 18 |
| 19 namespace user_prefs { |
| 18 class PrefRegistrySyncable; | 20 class PrefRegistrySyncable; |
| 21 } |
| 19 | 22 |
| 20 namespace extensions { | 23 namespace extensions { |
| 21 | 24 |
| 22 class Extension; | 25 class Extension; |
| 23 | 26 |
| 24 // For registering, loading, and unloading component extensions. | 27 // For registering, loading, and unloading component extensions. |
| 25 class ComponentLoader { | 28 class ComponentLoader { |
| 26 public: | 29 public: |
| 27 ComponentLoader(ExtensionServiceInterface* extension_service, | 30 ComponentLoader(ExtensionServiceInterface* extension_service, |
| 28 PrefService* prefs, | 31 PrefService* prefs, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // Call this during test setup to load component extensions that have | 76 // Call this during test setup to load component extensions that have |
| 74 // background pages for testing, which could otherwise interfere with tests. | 77 // background pages for testing, which could otherwise interfere with tests. |
| 75 static void EnableBackgroundExtensionsForTesting(); | 78 static void EnableBackgroundExtensionsForTesting(); |
| 76 | 79 |
| 77 // Adds the default component extensions. If |skip_session_components| | 80 // Adds the default component extensions. If |skip_session_components| |
| 78 // the loader will skip loading component extensions that weren't supposed to | 81 // the loader will skip loading component extensions that weren't supposed to |
| 79 // be loaded unless we are in signed user session (ChromeOS). For all other | 82 // be loaded unless we are in signed user session (ChromeOS). For all other |
| 80 // platforms this |skip_session_components| is expected to be unset. | 83 // platforms this |skip_session_components| is expected to be unset. |
| 81 void AddDefaultComponentExtensions(bool skip_session_components); | 84 void AddDefaultComponentExtensions(bool skip_session_components); |
| 82 | 85 |
| 83 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 86 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); |
| 84 | 87 |
| 85 // Parse the given JSON manifest. Returns NULL if it cannot be parsed, or if | 88 // Parse the given JSON manifest. Returns NULL if it cannot be parsed, or if |
| 86 // if the result is not a DictionaryValue. | 89 // if the result is not a DictionaryValue. |
| 87 DictionaryValue* ParseManifest(const std::string& manifest_contents) const; | 90 DictionaryValue* ParseManifest(const std::string& manifest_contents) const; |
| 88 | 91 |
| 89 // Clear the list of registered extensions. | 92 // Clear the list of registered extensions. |
| 90 void ClearAllRegistered(); | 93 void ClearAllRegistered(); |
| 91 | 94 |
| 92 // Reloads a registered component extension. | 95 // Reloads a registered component extension. |
| 93 void Reload(const std::string& extension_id); | 96 void Reload(const std::string& extension_id); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 RegisteredComponentExtensions component_extensions_; | 141 RegisteredComponentExtensions component_extensions_; |
| 139 | 142 |
| 140 PrefChangeRegistrar pref_change_registrar_; | 143 PrefChangeRegistrar pref_change_registrar_; |
| 141 | 144 |
| 142 DISALLOW_COPY_AND_ASSIGN(ComponentLoader); | 145 DISALLOW_COPY_AND_ASSIGN(ComponentLoader); |
| 143 }; | 146 }; |
| 144 | 147 |
| 145 } // namespace extensions | 148 } // namespace extensions |
| 146 | 149 |
| 147 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ | 150 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ |
| OLD | NEW |