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

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

Issue 174036: Get rid of the extension's "Current Version" file. (Closed)
Patch Set: merge conflicts Created 11 years, 4 months 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_EXTENSION_PREFS_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // Called when an extension is uninstalled, so that prefs get cleaned up. 42 // Called when an extension is uninstalled, so that prefs get cleaned up.
43 void OnExtensionUninstalled(const Extension* extension, 43 void OnExtensionUninstalled(const Extension* extension,
44 bool external_uninstall); 44 bool external_uninstall);
45 45
46 // Returns the state (enabled/disabled) of the given extension. 46 // Returns the state (enabled/disabled) of the given extension.
47 Extension::State GetExtensionState(const std::string& extension_id); 47 Extension::State GetExtensionState(const std::string& extension_id);
48 48
49 // Called to change the extension's state when it is enabled/disabled. 49 // Called to change the extension's state when it is enabled/disabled.
50 void SetExtensionState(Extension* extension, Extension::State); 50 void SetExtensionState(Extension* extension, Extension::State);
51 51
52 // Returns the version string for the currently installed extension, or
53 // the empty string if not found.
54 std::string GetVersionString(const std::string& extension_id);
55
56 // Ensure old extensions have fully up-to-date prefs values.
57 void MigrateToPrefs(Extension* extension);
58
52 // Returns base extensions install directory. 59 // Returns base extensions install directory.
53 const FilePath& install_directory() const { return install_directory_; } 60 const FilePath& install_directory() const { return install_directory_; }
54 61
55 // Updates the prefs based on the blacklist. 62 // Updates the prefs based on the blacklist.
56 void UpdateBlacklist(const std::set<std::string>& blacklist_set); 63 void UpdateBlacklist(const std::set<std::string>& blacklist_set);
57 64
58 // Based on extension id, checks prefs to see if it is blacklisted. 65 // Based on extension id, checks prefs to see if it is blacklisted.
59 bool IsExtensionBlacklisted(const std::string& id); 66 bool IsExtensionBlacklisted(const std::string& id);
60 67
61 private: 68 private:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); 106 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs);
100 }; 107 };
101 108
102 // A helper class that has a list of the currently installed extensions 109 // A helper class that has a list of the currently installed extensions
103 // and can iterate over them to a provided callback. 110 // and can iterate over them to a provided callback.
104 class InstalledExtensions { 111 class InstalledExtensions {
105 public: 112 public:
106 explicit InstalledExtensions(ExtensionPrefs* prefs); 113 explicit InstalledExtensions(ExtensionPrefs* prefs);
107 ~InstalledExtensions(); 114 ~InstalledExtensions();
108 115
109 typedef Callback3<const std::string&, 116 typedef Callback4<DictionaryValue*,
117 const std::string&,
110 const FilePath&, 118 const FilePath&,
111 Extension::Location>::Type Callback; 119 Extension::Location>::Type Callback;
112 120
113 // Runs |callback| for each installed extension with the path to the 121 // Runs |callback| for each installed extension with the path to the
114 // version directory and the location. Blacklisted extensions won't trigger 122 // version directory and the location. Blacklisted extensions won't trigger
115 // the callback. 123 // the callback. Ownership of |callback| is transferred to callee.
116 void VisitInstalledExtensions(Callback *callback); 124 void VisitInstalledExtensions(Callback *callback);
117 125
118 // Same as above, but only for the given extension.
119 void VisitInstalledExtension(const std::string& extension_id,
120 Callback *callback);
121
122 private: 126 private:
123 // A copy of the extensions pref dictionary so that this can be passed 127 // A copy of the extensions pref dictionary so that this can be passed
124 // around without a dependency on prefs. 128 // around without a dependency on prefs.
125 scoped_ptr<DictionaryValue> extension_data_; 129 scoped_ptr<DictionaryValue> extension_data_;
126 130
127 DISALLOW_COPY_AND_ASSIGN(InstalledExtensions); 131 DISALLOW_COPY_AND_ASSIGN(InstalledExtensions);
128 }; 132 };
129 133
130 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ 134 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_
131 135
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_file_util_unittest.cc ('k') | chrome/browser/extensions/extension_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698