Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: chrome/browser/extensions/component_loader.h

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
14 #include "base/values.h" 15 #include "base/values.h"
15 #include "content/public/browser/notification_observer.h"
16 16
17 class ExtensionServiceInterface; 17 class ExtensionServiceInterface;
18 class PrefService; 18 class PrefService;
19 19
20 namespace extensions { 20 namespace extensions {
21 21
22 class Extension; 22 class Extension;
23 23
24 // For registering, loading, and unloading component extensions. 24 // For registering, loading, and unloading component extensions.
25 class ComponentLoader : public content::NotificationObserver { 25 class ComponentLoader : public PrefObserver {
26 public: 26 public:
27 ComponentLoader(ExtensionServiceInterface* extension_service, 27 ComponentLoader(ExtensionServiceInterface* extension_service,
28 PrefService* prefs, 28 PrefService* prefs,
29 PrefService* local_state); 29 PrefService* local_state);
30 virtual ~ComponentLoader(); 30 virtual ~ComponentLoader();
31 31
32 size_t registered_extensions_count() const { 32 size_t registered_extensions_count() const {
33 return component_extensions_.size(); 33 return component_extensions_.size();
34 } 34 }
35 35
(...skipping 26 matching lines...) Expand all
62 bool Exists(const std::string& id) const; 62 bool Exists(const std::string& id) const;
63 63
64 // Unloads a component extension and removes it from the list of component 64 // Unloads a component extension and removes it from the list of component
65 // extensions to be loaded. 65 // extensions to be loaded.
66 void Remove(const FilePath& root_directory); 66 void Remove(const FilePath& root_directory);
67 void Remove(const std::string& id); 67 void Remove(const std::string& id);
68 68
69 // Adds the default component extensions. 69 // Adds the default component extensions.
70 void AddDefaultComponentExtensions(); 70 void AddDefaultComponentExtensions();
71 71
72 // content::NotificationObserver implementation 72 // PrefObserver implementation
73 virtual void Observe(int type, 73 virtual void OnPreferenceChanged(PrefServiceBase* service,
74 const content::NotificationSource& source, 74 const std::string& pref_name) OVERRIDE;
75 const content::NotificationDetails& details) OVERRIDE;
76 75
77 static void RegisterUserPrefs(PrefService* prefs); 76 static void RegisterUserPrefs(PrefService* prefs);
78 77
79 // Parse the given JSON manifest. Returns NULL if it cannot be parsed, or if 78 // Parse the given JSON manifest. Returns NULL if it cannot be parsed, or if
80 // if the result is not a DictionaryValue. 79 // if the result is not a DictionaryValue.
81 DictionaryValue* ParseManifest(const std::string& manifest_contents) const; 80 DictionaryValue* ParseManifest(const std::string& manifest_contents) const;
82 81
83 // Clear the list of registered extensions. 82 // Clear the list of registered extensions.
84 void ClearAllRegistered(); 83 void ClearAllRegistered();
85 84
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 PrefChangeRegistrar pref_change_registrar_; 137 PrefChangeRegistrar pref_change_registrar_;
139 138
140 std::string script_bubble_id_; 139 std::string script_bubble_id_;
141 140
142 DISALLOW_COPY_AND_ASSIGN(ComponentLoader); 141 DISALLOW_COPY_AND_ASSIGN(ComponentLoader);
143 }; 142 };
144 143
145 } // namespace extensions 144 } // namespace extensions
146 145
147 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_ 146 #endif // CHROME_BROWSER_EXTENSIONS_COMPONENT_LOADER_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/preference/preference_api.cc ('k') | chrome/browser/extensions/component_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698