| 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/file_path.h" |   11 #include "base/file_path.h" | 
|   12 #include "base/gtest_prod_util.h" |   12 #include "base/gtest_prod_util.h" | 
|   13 #include "base/prefs/public/pref_change_registrar.h" |   13 #include "base/prefs/public/pref_change_registrar.h" | 
|   14 #include "base/prefs/public/pref_observer.h" |  | 
|   15 #include "base/values.h" |   14 #include "base/values.h" | 
|   16  |   15  | 
|   17 class ExtensionServiceInterface; |   16 class ExtensionServiceInterface; | 
|   18 class PrefService; |   17 class PrefService; | 
|   19  |   18  | 
|   20 namespace extensions { |   19 namespace extensions { | 
|   21  |   20  | 
|   22 class Extension; |   21 class Extension; | 
|   23  |   22  | 
|   24 // For registering, loading, and unloading component extensions. |   23 // For registering, loading, and unloading component extensions. | 
|   25 class ComponentLoader : public PrefObserver { |   24 class ComponentLoader { | 
|   26  public: |   25  public: | 
|   27   ComponentLoader(ExtensionServiceInterface* extension_service, |   26   ComponentLoader(ExtensionServiceInterface* extension_service, | 
|   28                   PrefService* prefs, |   27                   PrefService* prefs, | 
|   29                   PrefService* local_state); |   28                   PrefService* local_state); | 
|   30   virtual ~ComponentLoader(); |   29   virtual ~ComponentLoader(); | 
|   31  |   30  | 
|   32   size_t registered_extensions_count() const { |   31   size_t registered_extensions_count() const { | 
|   33     return component_extensions_.size(); |   32     return component_extensions_.size(); | 
|   34   } |   33   } | 
|   35  |   34  | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
|   62   bool Exists(const std::string& id) const; |   61   bool Exists(const std::string& id) const; | 
|   63  |   62  | 
|   64   // Unloads a component extension and removes it from the list of component |   63   // Unloads a component extension and removes it from the list of component | 
|   65   // extensions to be loaded. |   64   // extensions to be loaded. | 
|   66   void Remove(const FilePath& root_directory); |   65   void Remove(const FilePath& root_directory); | 
|   67   void Remove(const std::string& id); |   66   void Remove(const std::string& id); | 
|   68  |   67  | 
|   69   // Adds the default component extensions. |   68   // Adds the default component extensions. | 
|   70   void AddDefaultComponentExtensions(); |   69   void AddDefaultComponentExtensions(); | 
|   71  |   70  | 
|   72   // PrefObserver implementation |  | 
|   73   virtual void OnPreferenceChanged(PrefServiceBase* service, |  | 
|   74                                    const std::string& pref_name) OVERRIDE; |  | 
|   75  |  | 
|   76   static void RegisterUserPrefs(PrefService* prefs); |   71   static void RegisterUserPrefs(PrefService* prefs); | 
|   77  |   72  | 
|   78   // Parse the given JSON manifest. Returns NULL if it cannot be parsed, or if |   73   // Parse the given JSON manifest. Returns NULL if it cannot be parsed, or if | 
|   79   // if the result is not a DictionaryValue. |   74   // if the result is not a DictionaryValue. | 
|   80   DictionaryValue* ParseManifest(const std::string& manifest_contents) const; |   75   DictionaryValue* ParseManifest(const std::string& manifest_contents) const; | 
|   81  |   76  | 
|   82   // Clear the list of registered extensions. |   77   // Clear the list of registered extensions. | 
|   83   void ClearAllRegistered(); |   78   void ClearAllRegistered(); | 
|   84  |   79  | 
|   85   // Reloads a registered component extension. |   80   // Reloads a registered component extension. | 
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  137   PrefChangeRegistrar pref_change_registrar_; |  132   PrefChangeRegistrar pref_change_registrar_; | 
|  138  |  133  | 
|  139   std::string script_bubble_id_; |  134   std::string script_bubble_id_; | 
|  140  |  135  | 
|  141   DISALLOW_COPY_AND_ASSIGN(ComponentLoader); |  136   DISALLOW_COPY_AND_ASSIGN(ComponentLoader); | 
|  142 }; |  137 }; | 
|  143  |  138  | 
|  144 }  // namespace extensions |  139 }  // namespace extensions | 
|  145  |  140  | 
|  146 #endif  // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ |  141 #endif  // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ | 
| OLD | NEW |