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

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

Issue 98463005: Enable/disable extensions upon changes in blacklist. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added UI, store blacklist state in prefs, +2 unittests. Created 6 years, 11 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 | 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_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>
11 11
12 #include "base/memory/linked_ptr.h" 12 #include "base/memory/linked_ptr.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/prefs/scoped_user_pref_update.h" 14 #include "base/prefs/scoped_user_pref_update.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "chrome/browser/extensions/blacklist_state.h"
17 #include "chrome/browser/extensions/extension_scoped_prefs.h" 18 #include "chrome/browser/extensions/extension_scoped_prefs.h"
18 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 19 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
19 #include "extensions/browser/app_sorting.h" 20 #include "extensions/browser/app_sorting.h"
20 #include "extensions/common/constants.h" 21 #include "extensions/common/constants.h"
21 #include "extensions/common/extension.h" 22 #include "extensions/common/extension.h"
22 #include "extensions/common/url_pattern_set.h" 23 #include "extensions/common/url_pattern_set.h"
23 #include "sync/api/string_ordinal.h" 24 #include "sync/api/string_ordinal.h"
24 25
25 class ExtensionPrefValueMap; 26 class ExtensionPrefValueMap;
26 class PrefService; 27 class PrefService;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 const syncer::StringOrdinal& page_ordinal); 184 const syncer::StringOrdinal& page_ordinal);
184 185
185 // Called when an extension is uninstalled, so that prefs get cleaned up. 186 // Called when an extension is uninstalled, so that prefs get cleaned up.
186 void OnExtensionUninstalled(const std::string& extension_id, 187 void OnExtensionUninstalled(const std::string& extension_id,
187 const Manifest::Location& location, 188 const Manifest::Location& location,
188 bool external_uninstall); 189 bool external_uninstall);
189 190
190 // Called to change the extension's state when it is enabled/disabled. 191 // Called to change the extension's state when it is enabled/disabled.
191 void SetExtensionState(const std::string& extension_id, Extension::State); 192 void SetExtensionState(const std::string& extension_id, Extension::State);
192 193
194 // Called to change the extension's BlacklistState. Currently only used for
195 // non-malicious extensions.
196 // TODO(oleg): replace SetExtensionBlacklisted by this function.
197 void SetExtensionBlacklistState(const std::string& extension_id,
198 BlacklistState state);
199
200 // Checks whether |extension_id| is marked as greylisted.
201 // TODO(oleg): Replace IsExtensionBlacklisted by this method.
202 BlacklistState GetExtensionBlacklistState(const std::string& extension_id);
203
193 // Populates |out| with the ids of all installed extensions. 204 // Populates |out| with the ids of all installed extensions.
194 void GetExtensions(ExtensionIdList* out); 205 void GetExtensions(ExtensionIdList* out);
195 206
196 // ExtensionScopedPrefs methods: 207 // ExtensionScopedPrefs methods:
197 virtual void UpdateExtensionPref(const std::string& id, 208 virtual void UpdateExtensionPref(const std::string& id,
198 const std::string& key, 209 const std::string& key,
199 base::Value* value) OVERRIDE; 210 base::Value* value) OVERRIDE;
200 211
201 virtual void DeleteExtensionPrefs(const std::string& id) OVERRIDE; 212 virtual void DeleteExtensionPrefs(const std::string& id) OVERRIDE;
202 213
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 bool did_escalate); 245 bool did_escalate);
235 246
236 // Getter and setters for disabled reason. 247 // Getter and setters for disabled reason.
237 int GetDisableReasons(const std::string& extension_id) const; 248 int GetDisableReasons(const std::string& extension_id) const;
238 void AddDisableReason(const std::string& extension_id, 249 void AddDisableReason(const std::string& extension_id,
239 Extension::DisableReason disable_reason); 250 Extension::DisableReason disable_reason);
240 void RemoveDisableReason(const std::string& extension_id, 251 void RemoveDisableReason(const std::string& extension_id,
241 Extension::DisableReason disable_reason); 252 Extension::DisableReason disable_reason);
242 void ClearDisableReasons(const std::string& extension_id); 253 void ClearDisableReasons(const std::string& extension_id);
243 254
244 // Gets the set of extensions that have been blacklisted in prefs. 255 // Gets the set of extensions that have been blacklisted in prefs. This will
256 // return only the blocked extensions, not the "greylist" extensions.
257 // TODO(oleg): Make method names consistent here, in extension service and in
258 // blacklist.
245 std::set<std::string> GetBlacklistedExtensions(); 259 std::set<std::string> GetBlacklistedExtensions();
246 260
247 // Sets whether the extension with |id| is blacklisted. 261 // Sets whether the extension with |id| is blacklisted.
248 void SetExtensionBlacklisted(const std::string& extension_id, 262 void SetExtensionBlacklisted(const std::string& extension_id,
249 bool is_blacklisted); 263 bool is_blacklisted);
250 264
251 // Returns the version string for the currently installed extension, or 265 // Returns the version string for the currently installed extension, or
252 // the empty string if not found. 266 // the empty string if not found.
253 std::string GetVersionString(const std::string& extension_id); 267 std::string GetVersionString(const std::string& extension_id);
254 268
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 scoped_ptr<TimeProvider> time_provider_; 642 scoped_ptr<TimeProvider> time_provider_;
629 643
630 bool extensions_disabled_; 644 bool extensions_disabled_;
631 645
632 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs); 646 DISALLOW_COPY_AND_ASSIGN(ExtensionPrefs);
633 }; 647 };
634 648
635 } // namespace extensions 649 } // namespace extensions
636 650
637 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_ 651 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PREFS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_prefs.cc » ('j') | chrome/browser/extensions/extension_prefs.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698