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

Side by Side 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 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_SERVICE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 bool being_upgraded; 626 bool being_upgraded;
627 627
628 // True if the extension has used the webRequest API. 628 // True if the extension has used the webRequest API.
629 bool has_used_webrequest; 629 bool has_used_webrequest;
630 630
631 ExtensionRuntimeData(); 631 ExtensionRuntimeData();
632 ~ExtensionRuntimeData(); 632 ~ExtensionRuntimeData();
633 }; 633 };
634 typedef std::map<std::string, ExtensionRuntimeData> ExtensionRuntimeDataMap; 634 typedef std::map<std::string, ExtensionRuntimeData> ExtensionRuntimeDataMap;
635 635
636 // Populates greylist_.
637 void LoadGreylistFromPrefs();
638
636 // Signals *ready_ and sends a notification to the listeners. 639 // Signals *ready_ and sends a notification to the listeners.
637 void SetReadyAndNotifyListeners(); 640 void SetReadyAndNotifyListeners();
638 641
639 // Return true if the sync type of |extension| matches |type|. 642 // Return true if the sync type of |extension| matches |type|.
640 void OnExtensionInstallPrefChanged(); 643 void OnExtensionInstallPrefChanged();
641 644
642 // Adds the given extension to the list of terminated extensions if 645 // Adds the given extension to the list of terminated extensions if
643 // it is not already there and unloads it. 646 // it is not already there and unloads it.
644 void TrackTerminatedExtension(const extensions::Extension* extension); 647 void TrackTerminatedExtension(const extensions::Extension* extension);
645 648
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 // Helper to search storage directories for extensions with isolated storage 696 // Helper to search storage directories for extensions with isolated storage
694 // that have been orphaned by an uninstall. 697 // that have been orphaned by an uninstall.
695 void GarbageCollectIsolatedStorage(); 698 void GarbageCollectIsolatedStorage();
696 void OnGarbageCollectIsolatedStorageFinished(); 699 void OnGarbageCollectIsolatedStorageFinished();
697 700
698 // extensions::Blacklist::Observer implementation. 701 // extensions::Blacklist::Observer implementation.
699 virtual void OnBlacklistUpdated() OVERRIDE; 702 virtual void OnBlacklistUpdated() OVERRIDE;
700 703
701 // Manages the blacklisted extensions, intended as callback from 704 // Manages the blacklisted extensions, intended as callback from
702 // Blacklist::GetBlacklistedIDs. 705 // Blacklist::GetBlacklistedIDs.
703 void ManageBlacklist(const std::set<std::string>& blacklisted_ids); 706 void ManageBlacklist(
707 const extensions::Blacklist::BlacklistStateMap& blacklisted_ids);
708
709 // Add extensions in |blocked| to blacklisted_extensions, remove extensions
710 // that are neither in |blocked|, nor in |unchanged|.
711 void UpdateBlockedExtensions(const std::set<std::string>& blocked,
712 const std::set<std::string>& unchanged);
713
714 void UpdateGreylistedExtensions(
715 const std::set<std::string>& greylist,
716 const std::set<std::string>& unchanged,
717 const extensions::Blacklist::BlacklistStateMap& state_map);
704 718
705 // Controls if installs are delayed. See comment for 719 // Controls if installs are delayed. See comment for
706 // |installs_delayed_for_gc_|. 720 // |installs_delayed_for_gc_|.
707 void set_installs_delayed_for_gc(bool value) { 721 void set_installs_delayed_for_gc(bool value) {
708 installs_delayed_for_gc_ = value; 722 installs_delayed_for_gc_ = value;
709 } 723 }
710 bool installs_delayed_for_gc() const { return installs_delayed_for_gc_; } 724 bool installs_delayed_for_gc() const { return installs_delayed_for_gc_; }
711 725
712 // Used only by test code. 726 // Used only by test code.
713 void UnloadAllExtensionsInternal(); 727 void UnloadAllExtensionsInternal();
(...skipping 12 matching lines...) Expand all
726 740
727 // Settings for the owning profile. 741 // Settings for the owning profile.
728 scoped_ptr<extensions::SettingsFrontend> settings_frontend_; 742 scoped_ptr<extensions::SettingsFrontend> settings_frontend_;
729 743
730 // The ExtensionSyncService that is used by this ExtensionService. 744 // The ExtensionSyncService that is used by this ExtensionService.
731 ExtensionSyncService* extension_sync_service_; 745 ExtensionSyncService* extension_sync_service_;
732 746
733 // Sets of enabled/disabled/terminated/blacklisted extensions. Not owned. 747 // Sets of enabled/disabled/terminated/blacklisted extensions. Not owned.
734 extensions::ExtensionRegistry* registry_; 748 extensions::ExtensionRegistry* registry_;
735 749
750 // Set of greylisted extensions. These extensions are disabled if they are
751 // already installed in Chromium at the time when they are added to
752 // the greylist. Unlike blacklisted extensions, greylisted ones are visible
753 // to the user and if user re-enables such an extension, they remain enabled.
754 //
755 // These extensions should appear in registry_.
756 extensions::ExtensionSet greylist_;
757
736 // The list of extension installs delayed for various reasons. The reason 758 // The list of extension installs delayed for various reasons. The reason
737 // for delayed install is stored in ExtensionPrefs. These are not part of 759 // for delayed install is stored in ExtensionPrefs. These are not part of
738 // ExtensionRegistry because they are not yet installed. 760 // ExtensionRegistry because they are not yet installed.
739 extensions::ExtensionSet delayed_installs_; 761 extensions::ExtensionSet delayed_installs_;
740 762
741 // Hold the set of pending extensions. 763 // Hold the set of pending extensions.
742 extensions::PendingExtensionManager pending_extension_manager_; 764 extensions::PendingExtensionManager pending_extension_manager_;
743 765
744 // The map of extension IDs to their runtime data. 766 // The map of extension IDs to their runtime data.
745 ExtensionRuntimeDataMap extension_runtime_data_; 767 ExtensionRuntimeDataMap extension_runtime_data_;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 InstallAppsAndCheckStorageProtection); 873 InstallAppsAndCheckStorageProtection);
852 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, SetUnsetBlacklistInPrefs); 874 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, SetUnsetBlacklistInPrefs);
853 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 875 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
854 BlacklistedExtensionWillNotInstall); 876 BlacklistedExtensionWillNotInstall);
855 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 877 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
856 UnloadBlacklistedExtensionPolicy); 878 UnloadBlacklistedExtensionPolicy);
857 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 879 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
858 WillNotLoadBlacklistedExtensionsFromDirectory); 880 WillNotLoadBlacklistedExtensionsFromDirectory);
859 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 881 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
860 BlacklistedInPrefsFromStartup); 882 BlacklistedInPrefsFromStartup);
883 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
884 GreylistedExtensionDisabled);
885 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
886 GreylistDontEnableManuallyDisabled);
887 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
888 GreylistUnknownDontChange);
861 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 889 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
862 }; 890 };
863 891
864 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 892 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698