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

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: Show blacklist state together with location. 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 class CrxInstaller; 55 class CrxInstaller;
56 class ExtensionActionStorageManager; 56 class ExtensionActionStorageManager;
57 class ExtensionRegistry; 57 class ExtensionRegistry;
58 class ExtensionSystem; 58 class ExtensionSystem;
59 class ExtensionUpdater; 59 class ExtensionUpdater;
60 class PendingExtensionManager; 60 class PendingExtensionManager;
61 class SettingsFrontend; 61 class SettingsFrontend;
62 class UpdateObserver; 62 class UpdateObserver;
63 } // namespace extensions 63 } // namespace extensions
64 64
65 using extensions::ExtensionIdSet;
66
65 namespace syncer { 67 namespace syncer {
66 class SyncErrorFactory; 68 class SyncErrorFactory;
67 } 69 }
68 70
69 // This is an interface class to encapsulate the dependencies that 71 // This is an interface class to encapsulate the dependencies that
70 // various classes have on ExtensionService. This allows easy mocking. 72 // various classes have on ExtensionService. This allows easy mocking.
71 class ExtensionServiceInterface 73 class ExtensionServiceInterface
72 : public base::SupportsWeakPtr<ExtensionServiceInterface> { 74 : public base::SupportsWeakPtr<ExtensionServiceInterface> {
73 public: 75 public:
74 virtual ~ExtensionServiceInterface() {} 76 virtual ~ExtensionServiceInterface() {}
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 #if defined(OS_CHROMEOS) 594 #if defined(OS_CHROMEOS)
593 void disable_garbage_collection() { 595 void disable_garbage_collection() {
594 disable_garbage_collection_ = true; 596 disable_garbage_collection_ = true;
595 } 597 }
596 void enable_garbage_collection() { 598 void enable_garbage_collection() {
597 disable_garbage_collection_ = false; 599 disable_garbage_collection_ = false;
598 } 600 }
599 #endif 601 #endif
600 602
601 private: 603 private:
604 // Populates greylist_.
605 void LoadGreylistFromPrefs();
606
602 // Signals *ready_ and sends a notification to the listeners. 607 // Signals *ready_ and sends a notification to the listeners.
603 void SetReadyAndNotifyListeners(); 608 void SetReadyAndNotifyListeners();
604 609
605 // Return true if the sync type of |extension| matches |type|. 610 // Return true if the sync type of |extension| matches |type|.
606 void OnExtensionInstallPrefChanged(); 611 void OnExtensionInstallPrefChanged();
607 612
608 // Adds the given extension to the list of terminated extensions if 613 // Adds the given extension to the list of terminated extensions if
609 // it is not already there and unloads it. 614 // it is not already there and unloads it.
610 void TrackTerminatedExtension(const extensions::Extension* extension); 615 void TrackTerminatedExtension(const extensions::Extension* extension);
611 616
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 // Helper to search storage directories for extensions with isolated storage 664 // Helper to search storage directories for extensions with isolated storage
660 // that have been orphaned by an uninstall. 665 // that have been orphaned by an uninstall.
661 void GarbageCollectIsolatedStorage(); 666 void GarbageCollectIsolatedStorage();
662 void OnGarbageCollectIsolatedStorageFinished(); 667 void OnGarbageCollectIsolatedStorageFinished();
663 668
664 // extensions::Blacklist::Observer implementation. 669 // extensions::Blacklist::Observer implementation.
665 virtual void OnBlacklistUpdated() OVERRIDE; 670 virtual void OnBlacklistUpdated() OVERRIDE;
666 671
667 // Manages the blacklisted extensions, intended as callback from 672 // Manages the blacklisted extensions, intended as callback from
668 // Blacklist::GetBlacklistedIDs. 673 // Blacklist::GetBlacklistedIDs.
669 void ManageBlacklist(const std::set<std::string>& blacklisted_ids); 674 void ManageBlacklist(
675 const extensions::Blacklist::BlacklistStateMap& blacklisted_ids);
676
677 // Add extensions in |blocked| to blacklisted_extensions, remove extensions
678 // that are neither in |blocked|, nor in |unchanged|.
679 void UpdateBlockedExtensions(const ExtensionIdSet& blocked,
680 const ExtensionIdSet& unchanged);
681
682 void UpdateGreylistedExtensions(
683 const ExtensionIdSet& greylist,
684 const ExtensionIdSet& unchanged,
685 const extensions::Blacklist::BlacklistStateMap& state_map);
670 686
671 // Controls if installs are delayed. See comment for 687 // Controls if installs are delayed. See comment for
672 // |installs_delayed_for_gc_|. 688 // |installs_delayed_for_gc_|.
673 void set_installs_delayed_for_gc(bool value) { 689 void set_installs_delayed_for_gc(bool value) {
674 installs_delayed_for_gc_ = value; 690 installs_delayed_for_gc_ = value;
675 } 691 }
676 bool installs_delayed_for_gc() const { return installs_delayed_for_gc_; } 692 bool installs_delayed_for_gc() const { return installs_delayed_for_gc_; }
677 693
678 // Used only by test code. 694 // Used only by test code.
679 void UnloadAllExtensionsInternal(); 695 void UnloadAllExtensionsInternal();
(...skipping 12 matching lines...) Expand all
692 708
693 // Settings for the owning profile. 709 // Settings for the owning profile.
694 scoped_ptr<extensions::SettingsFrontend> settings_frontend_; 710 scoped_ptr<extensions::SettingsFrontend> settings_frontend_;
695 711
696 // The ExtensionSyncService that is used by this ExtensionService. 712 // The ExtensionSyncService that is used by this ExtensionService.
697 ExtensionSyncService* extension_sync_service_; 713 ExtensionSyncService* extension_sync_service_;
698 714
699 // Sets of enabled/disabled/terminated/blacklisted extensions. Not owned. 715 // Sets of enabled/disabled/terminated/blacklisted extensions. Not owned.
700 extensions::ExtensionRegistry* registry_; 716 extensions::ExtensionRegistry* registry_;
701 717
718 // Set of greylisted extensions. These extensions are disabled if they are
719 // already installed in Chromium at the time when they are added to
720 // the greylist. Unlike blacklisted extensions, greylisted ones are visible
721 // to the user and if user re-enables such an extension, they remain enabled.
722 //
723 // These extensions should appear in registry_.
724 extensions::ExtensionSet greylist_;
725
702 // The list of extension installs delayed for various reasons. The reason 726 // The list of extension installs delayed for various reasons. The reason
703 // for delayed install is stored in ExtensionPrefs. These are not part of 727 // for delayed install is stored in ExtensionPrefs. These are not part of
704 // ExtensionRegistry because they are not yet installed. 728 // ExtensionRegistry because they are not yet installed.
705 extensions::ExtensionSet delayed_installs_; 729 extensions::ExtensionSet delayed_installs_;
706 730
707 // Hold the set of pending extensions. 731 // Hold the set of pending extensions.
708 extensions::PendingExtensionManager pending_extension_manager_; 732 extensions::PendingExtensionManager pending_extension_manager_;
709 733
710 // The full path to the directory where extensions are installed. 734 // The full path to the directory where extensions are installed.
711 base::FilePath install_directory_; 735 base::FilePath install_directory_;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 InstallAppsAndCheckStorageProtection); 838 InstallAppsAndCheckStorageProtection);
815 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, SetUnsetBlacklistInPrefs); 839 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, SetUnsetBlacklistInPrefs);
816 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 840 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
817 BlacklistedExtensionWillNotInstall); 841 BlacklistedExtensionWillNotInstall);
818 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 842 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
819 UnloadBlacklistedExtensionPolicy); 843 UnloadBlacklistedExtensionPolicy);
820 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 844 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
821 WillNotLoadBlacklistedExtensionsFromDirectory); 845 WillNotLoadBlacklistedExtensionsFromDirectory);
822 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 846 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
823 BlacklistedInPrefsFromStartup); 847 BlacklistedInPrefsFromStartup);
848 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
849 GreylistedExtensionDisabled);
850 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
851 GreylistDontEnableManuallyDisabled);
852 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
853 GreylistUnknownDontChange);
824 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 854 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
825 }; 855 };
826 856
827 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 857 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698