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

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

Issue 11419307: Garbage Collect the Storage directory on next profile start after an extension uninstall. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Basic code done. Created 8 years 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 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 818
819 // Helper to determine if an extension is idle, and it should be safe 819 // Helper to determine if an extension is idle, and it should be safe
820 // to update the extension. 820 // to update the extension.
821 bool IsExtensionIdle(const std::string& extension_id) const; 821 bool IsExtensionIdle(const std::string& extension_id) const;
822 822
823 // Helper to determine if updating an extensions should proceed immediately, 823 // Helper to determine if updating an extensions should proceed immediately,
824 // or if we should delay the update until further notice. 824 // or if we should delay the update until further notice.
825 bool ShouldDelayExtensionUpdate(const std::string& extension_id, 825 bool ShouldDelayExtensionUpdate(const std::string& extension_id,
826 bool wait_for_idle) const; 826 bool wait_for_idle) const;
827 827
828 // Helper to search remove an storage directories for extensions with
Charlie Reis 2012/12/05 02:25:40 nit: "search remove an" typo
awong 2012/12/08 01:45:23 Done.
829 // isolated storage that have been orphaned by an uninstall.
830 void GarbageCollectIsolatedStorage();
831 void OnGarbageCollectIsolatedStorageFinished();
832
828 // extensions::Blacklist::Observer implementation. 833 // extensions::Blacklist::Observer implementation.
829 virtual void OnBlacklistUpdated() OVERRIDE; 834 virtual void OnBlacklistUpdated() OVERRIDE;
830 835
836 void set_delay_all_installs(bool value) { delay_all_installs_ = value; }
Charlie Reis 2012/12/05 02:25:40 Please add a comment to these saying why they're n
awong 2012/12/08 01:45:23 Done.
837 bool delay_all_installs() const { return delay_all_installs_; }
Charlie Reis 2012/12/05 02:25:40 nit: Maybe should_delay_all_installs()? (It sounds
awong 2012/12/08 01:45:23 How about installs_delayed()? should_delay_all_in
838
831 // The normal profile associated with this ExtensionService. 839 // The normal profile associated with this ExtensionService.
832 Profile* profile_; 840 Profile* profile_;
833 841
834 // The ExtensionSystem for the profile above. 842 // The ExtensionSystem for the profile above.
835 extensions::ExtensionSystem* system_; 843 extensions::ExtensionSystem* system_;
836 844
837 // Preferences for the owning profile (weak reference). 845 // Preferences for the owning profile (weak reference).
838 extensions::ExtensionPrefs* extension_prefs_; 846 extensions::ExtensionPrefs* extension_prefs_;
839 847
840 // Settings for the owning profile. 848 // Settings for the owning profile.
841 scoped_ptr<extensions::SettingsFrontend> settings_frontend_; 849 scoped_ptr<extensions::SettingsFrontend> settings_frontend_;
842 850
843 // The current list of installed extensions. 851 // The current list of installed extensions.
844 ExtensionSet extensions_; 852 ExtensionSet extensions_;
845 853
846 // The list of installed extensions that have been disabled. 854 // The list of installed extensions that have been disabled.
847 ExtensionSet disabled_extensions_; 855 ExtensionSet disabled_extensions_;
848 856
849 // The list of installed extensions that have been terminated. 857 // The list of installed extensions that have been terminated.
850 ExtensionSet terminated_extensions_; 858 ExtensionSet terminated_extensions_;
851 859
852 // The list of extension updates that are waiting to be installed. 860 // The list of extension updates that are waiting to be installed.
853 ExtensionSet pending_extension_updates_; 861 ExtensionSet pending_extension_updates_;
854 862
863 // The list of extension installs delayed by |delay_all_installs_|.
864 struct PendingInstall {
865 PendingInstall(const extensions::Extension* extension,
866 const syncer::StringOrdinal& page_ordinal,
867 bool has_requirement_errors,
868 bool wait_for_idle);
869 ~PendingInstall();
870
871 scoped_refptr<const extensions::Extension> extension;
872 syncer::StringOrdinal page_ordinal;
873 bool has_requirement_errors;
874 bool wait_for_idle;
875 };
876 std::vector<PendingInstall> pending_extension_installs_;
877
855 // Hold the set of pending extensions. 878 // Hold the set of pending extensions.
856 extensions::PendingExtensionManager pending_extension_manager_; 879 extensions::PendingExtensionManager pending_extension_manager_;
857 880
858 // The map of extension IDs to their runtime data. 881 // The map of extension IDs to their runtime data.
859 ExtensionRuntimeDataMap extension_runtime_data_; 882 ExtensionRuntimeDataMap extension_runtime_data_;
860 883
861 // The full path to the directory where extensions are installed. 884 // The full path to the directory where extensions are installed.
862 FilePath install_directory_; 885 FilePath install_directory_;
863 886
864 // Whether or not extensions are enabled. 887 // Whether or not extensions are enabled.
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 // has to wait for the external providers. Used in 991 // has to wait for the external providers. Used in
969 // OnAllExternalProvidersReady() to determine if an update check is needed to 992 // OnAllExternalProvidersReady() to determine if an update check is needed to
970 // install pending extensions. 993 // install pending extensions.
971 bool update_once_all_providers_are_ready_; 994 bool update_once_all_providers_are_ready_;
972 995
973 // Set when the browser is terminating. Prevents us from installing or 996 // Set when the browser is terminating. Prevents us from installing or
974 // updating additional extensions and allows in-progress installations to 997 // updating additional extensions and allows in-progress installations to
975 // decide to abort. 998 // decide to abort.
976 bool browser_terminating_; 999 bool browser_terminating_;
977 1000
1001 // Set to true to delay all new extension installations. Allows garbage
1002 // collection of on disk state to proceed without worrying about race
1003 // conditions caused by extension installations during the garbage
1004 // collection process.
1005 bool delay_all_installs_;
1006
978 NaClModuleInfoList nacl_module_list_; 1007 NaClModuleInfoList nacl_module_list_;
979 1008
980 extensions::AppSyncBundle app_sync_bundle_; 1009 extensions::AppSyncBundle app_sync_bundle_;
981 extensions::ExtensionSyncBundle extension_sync_bundle_; 1010 extensions::ExtensionSyncBundle extension_sync_bundle_;
982 1011
983 extensions::ProcessMap process_map_; 1012 extensions::ProcessMap process_map_;
984 1013
985 extensions::AppShortcutManager app_shortcut_manager_; 1014 extensions::AppShortcutManager app_shortcut_manager_;
986 1015
987 scoped_ptr<ExtensionErrorUI> extension_error_ui_; 1016 scoped_ptr<ExtensionErrorUI> extension_error_ui_;
988 // Sequenced task runner for extension related file operations. 1017 // Sequenced task runner for extension related file operations.
989 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; 1018 scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
990 1019
991 #if defined(ENABLE_EXTENSIONS) 1020 #if defined(ENABLE_EXTENSIONS)
992 scoped_ptr<extensions::ExtensionActionStorageManager> 1021 scoped_ptr<extensions::ExtensionActionStorageManager>
993 extension_action_storage_manager_; 1022 extension_action_storage_manager_;
994 #endif 1023 #endif
995 1024
996 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 1025 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
997 InstallAppsWithUnlimtedStorage); 1026 InstallAppsWithUnlimtedStorage);
998 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 1027 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
999 InstallAppsAndCheckStorageProtection); 1028 InstallAppsAndCheckStorageProtection);
1000 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 1029 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
1001 }; 1030 };
1002 1031
1003 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 1032 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698