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

Unified Diff: chrome/browser/extensions/extension_service.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_service.h
diff --git a/chrome/browser/extensions/extension_service.h b/chrome/browser/extensions/extension_service.h
index a388b98a7bfc8fcdc128d159be897f381503e628..18ffaf1896b10ff0bd83897e1351bd9c571c031b 100644
--- a/chrome/browser/extensions/extension_service.h
+++ b/chrome/browser/extensions/extension_service.h
@@ -633,6 +633,9 @@ class ExtensionService
};
typedef std::map<std::string, ExtensionRuntimeData> ExtensionRuntimeDataMap;
+ // Populates greylist_.
+ void LoadGreylistFromPrefs();
+
// Signals *ready_ and sends a notification to the listeners.
void SetReadyAndNotifyListeners();
@@ -700,7 +703,18 @@ class ExtensionService
// Manages the blacklisted extensions, intended as callback from
// Blacklist::GetBlacklistedIDs.
- void ManageBlacklist(const std::set<std::string>& blacklisted_ids);
+ void ManageBlacklist(
+ const extensions::Blacklist::BlacklistStateMap& blacklisted_ids);
+
+ // Add extensions in |blocked| to blacklisted_extensions, remove extensions
+ // that are neither in |blocked|, nor in |unchanged|.
+ void UpdateBlockedExtensions(const std::set<std::string>& blocked,
+ const std::set<std::string>& unchanged);
+
+ void UpdateGreylistedExtensions(
+ const std::set<std::string>& greylist,
+ const std::set<std::string>& unchanged,
+ const extensions::Blacklist::BlacklistStateMap& state_map);
// Controls if installs are delayed. See comment for
// |installs_delayed_for_gc_|.
@@ -733,6 +747,14 @@ class ExtensionService
// Sets of enabled/disabled/terminated/blacklisted extensions. Not owned.
extensions::ExtensionRegistry* registry_;
+ // Set of greylisted extensions. These extensions are disabled if they are
+ // already installed in Chromium at the time when they are added to
+ // the greylist. Unlike blacklisted extensions, greylisted ones are visible
+ // to the user and if user re-enables such an extension, they remain enabled.
+ //
+ // These extensions should appear in registry_.
+ extensions::ExtensionSet greylist_;
+
// The list of extension installs delayed for various reasons. The reason
// for delayed install is stored in ExtensionPrefs. These are not part of
// ExtensionRegistry because they are not yet installed.
@@ -858,6 +880,12 @@ class ExtensionService
WillNotLoadBlacklistedExtensionsFromDirectory);
FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
BlacklistedInPrefsFromStartup);
+ FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
+ GreylistedExtensionDisabled);
+ FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
+ GreylistDontEnableManuallyDisabled);
+ FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
+ GreylistUnknownDontChange);
DISALLOW_COPY_AND_ASSIGN(ExtensionService);
};

Powered by Google App Engine
This is Rietveld 408576698