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

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: Created 6 years, 10 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 #if defined(OS_CHROMEOS) 596 #if defined(OS_CHROMEOS)
595 void disable_garbage_collection() { 597 void disable_garbage_collection() {
596 disable_garbage_collection_ = true; 598 disable_garbage_collection_ = true;
597 } 599 }
598 void enable_garbage_collection() { 600 void enable_garbage_collection() {
599 disable_garbage_collection_ = false; 601 disable_garbage_collection_ = false;
600 } 602 }
601 #endif 603 #endif
602 604
603 private: 605 private:
606 // Populates greylist_.
607 void LoadGreylistFromPrefs();
608
604 // Signals *ready_ and sends a notification to the listeners. 609 // Signals *ready_ and sends a notification to the listeners.
605 void SetReadyAndNotifyListeners(); 610 void SetReadyAndNotifyListeners();
606 611
607 // Return true if the sync type of |extension| matches |type|. 612 // Return true if the sync type of |extension| matches |type|.
608 void OnExtensionInstallPrefChanged(); 613 void OnExtensionInstallPrefChanged();
609 614
610 // Adds the given extension to the list of terminated extensions if 615 // Adds the given extension to the list of terminated extensions if
611 // it is not already there and unloads it. 616 // it is not already there and unloads it.
612 void TrackTerminatedExtension(const extensions::Extension* extension); 617 void TrackTerminatedExtension(const extensions::Extension* extension);
613 618
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 // Helper to search storage directories for extensions with isolated storage 666 // Helper to search storage directories for extensions with isolated storage
662 // that have been orphaned by an uninstall. 667 // that have been orphaned by an uninstall.
663 void GarbageCollectIsolatedStorage(); 668 void GarbageCollectIsolatedStorage();
664 void OnGarbageCollectIsolatedStorageFinished(); 669 void OnGarbageCollectIsolatedStorageFinished();
665 670
666 // extensions::Blacklist::Observer implementation. 671 // extensions::Blacklist::Observer implementation.
667 virtual void OnBlacklistUpdated() OVERRIDE; 672 virtual void OnBlacklistUpdated() OVERRIDE;
668 673
669 // Manages the blacklisted extensions, intended as callback from 674 // Manages the blacklisted extensions, intended as callback from
670 // Blacklist::GetBlacklistedIDs. 675 // Blacklist::GetBlacklistedIDs.
671 void ManageBlacklist(const std::set<std::string>& blacklisted_ids); 676 void ManageBlacklist(
677 const extensions::Blacklist::BlacklistStateMap& blacklisted_ids);
678
679 // Add extensions in |blocked| to blacklisted_extensions, remove extensions
680 // that are neither in |blocked|, nor in |unchanged|.
681 void UpdateBlockedExtensions(const ExtensionIdSet& blocked,
682 const ExtensionIdSet& unchanged);
683
684 void UpdateGreylistedExtensions(
685 const ExtensionIdSet& greylist,
686 const ExtensionIdSet& unchanged,
687 const extensions::Blacklist::BlacklistStateMap& state_map);
672 688
673 // Controls if installs are delayed. See comment for 689 // Controls if installs are delayed. See comment for
674 // |installs_delayed_for_gc_|. 690 // |installs_delayed_for_gc_|.
675 void set_installs_delayed_for_gc(bool value) { 691 void set_installs_delayed_for_gc(bool value) {
676 installs_delayed_for_gc_ = value; 692 installs_delayed_for_gc_ = value;
677 } 693 }
678 bool installs_delayed_for_gc() const { return installs_delayed_for_gc_; } 694 bool installs_delayed_for_gc() const { return installs_delayed_for_gc_; }
679 695
680 // Used only by test code. 696 // Used only by test code.
681 void UnloadAllExtensionsInternal(); 697 void UnloadAllExtensionsInternal();
(...skipping 12 matching lines...) Expand all
694 710
695 // Settings for the owning profile. 711 // Settings for the owning profile.
696 scoped_ptr<extensions::SettingsFrontend> settings_frontend_; 712 scoped_ptr<extensions::SettingsFrontend> settings_frontend_;
697 713
698 // The ExtensionSyncService that is used by this ExtensionService. 714 // The ExtensionSyncService that is used by this ExtensionService.
699 ExtensionSyncService* extension_sync_service_; 715 ExtensionSyncService* extension_sync_service_;
700 716
701 // Sets of enabled/disabled/terminated/blacklisted extensions. Not owned. 717 // Sets of enabled/disabled/terminated/blacklisted extensions. Not owned.
702 extensions::ExtensionRegistry* registry_; 718 extensions::ExtensionRegistry* registry_;
703 719
720 // Set of greylisted extensions. These extensions are disabled if they are
721 // already installed in Chromium at the time when they are added to
722 // the greylist. Unlike blacklisted extensions, greylisted ones are visible
723 // to the user and if user re-enables such an extension, they remain enabled.
724 //
725 // These extensions should appear in registry_.
726 extensions::ExtensionSet greylist_;
727
704 // The list of extension installs delayed for various reasons. The reason 728 // The list of extension installs delayed for various reasons. The reason
705 // for delayed install is stored in ExtensionPrefs. These are not part of 729 // for delayed install is stored in ExtensionPrefs. These are not part of
706 // ExtensionRegistry because they are not yet installed. 730 // ExtensionRegistry because they are not yet installed.
707 extensions::ExtensionSet delayed_installs_; 731 extensions::ExtensionSet delayed_installs_;
708 732
709 // Hold the set of pending extensions. 733 // Hold the set of pending extensions.
710 extensions::PendingExtensionManager pending_extension_manager_; 734 extensions::PendingExtensionManager pending_extension_manager_;
711 735
712 // The full path to the directory where extensions are installed. 736 // The full path to the directory where extensions are installed.
713 base::FilePath install_directory_; 737 base::FilePath install_directory_;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 InstallAppsAndCheckStorageProtection); 840 InstallAppsAndCheckStorageProtection);
817 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, SetUnsetBlacklistInPrefs); 841 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, SetUnsetBlacklistInPrefs);
818 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 842 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
819 BlacklistedExtensionWillNotInstall); 843 BlacklistedExtensionWillNotInstall);
820 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 844 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
821 UnloadBlacklistedExtensionPolicy); 845 UnloadBlacklistedExtensionPolicy);
822 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 846 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
823 WillNotLoadBlacklistedExtensionsFromDirectory); 847 WillNotLoadBlacklistedExtensionsFromDirectory);
824 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 848 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
825 BlacklistedInPrefsFromStartup); 849 BlacklistedInPrefsFromStartup);
850 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
851 GreylistedExtensionDisabled);
852 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
853 GreylistDontEnableManuallyDisabled);
854 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
855 GreylistUnknownDontChange);
826 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 856 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
827 }; 857 };
828 858
829 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 859 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_prefs_unittest.cc ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698