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

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: small fixes. 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 }; 320 };
321 321
322 // Look up an extension by ID, selecting which sets to look in: 322 // Look up an extension by ID, selecting which sets to look in:
323 // * extensions() --> INCLUDE_ENABLED 323 // * extensions() --> INCLUDE_ENABLED
324 // * disabled_extensions() --> INCLUDE_DISABLED 324 // * disabled_extensions() --> INCLUDE_DISABLED
325 // * terminated_extensions() --> INCLUDE_TERMINATED 325 // * terminated_extensions() --> INCLUDE_TERMINATED
326 // * blacklisted_extensions() --> INCLUDE_BLACKLISTED 326 // * blacklisted_extensions() --> INCLUDE_BLACKLISTED
327 const extensions::Extension* GetExtensionById(const std::string& id, 327 const extensions::Extension* GetExtensionById(const std::string& id,
328 int include_mask) const; 328 int include_mask) const;
329 329
330 // Returns the site of the given |extension_id|. Suitable for use with
331 // BrowserContext::GetStoragePartitionForSite()
332 GURL GetSiteForExtensionId(const std::string& extension_id);
333
330 // Looks up a terminated (crashed) extension by ID. 334 // Looks up a terminated (crashed) extension by ID.
331 const extensions::Extension* 335 const extensions::Extension*
332 GetTerminatedExtension(const std::string& id) const; 336 GetTerminatedExtension(const std::string& id) const;
333 337
334 // Looks up an extension by ID, regardless of whether it's enabled, 338 // Looks up an extension by ID, regardless of whether it's enabled,
335 // disabled, blacklisted, or terminated. 339 // disabled, blacklisted, or terminated.
336 virtual const extensions::Extension* GetInstalledExtension( 340 virtual const extensions::Extension* GetInstalledExtension(
337 const std::string& id) const OVERRIDE; 341 const std::string& id) const OVERRIDE;
338 342
339 // Updates a currently-installed extension with the contents from 343 // Updates a currently-installed extension with the contents from
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 void TrackTerminatedExtension(const extensions::Extension* extension); 775 void TrackTerminatedExtension(const extensions::Extension* extension);
772 776
773 // Removes the extension with the given id from the list of 777 // Removes the extension with the given id from the list of
774 // terminated extensions if it is there. 778 // terminated extensions if it is there.
775 void UntrackTerminatedExtension(const std::string& id); 779 void UntrackTerminatedExtension(const std::string& id);
776 780
777 // Update preferences for a new or updated extension; notify observers that 781 // Update preferences for a new or updated extension; notify observers that
778 // the extension is installed, e.g., to update event handlers on background 782 // the extension is installed, e.g., to update event handlers on background
779 // pages; and perform other extension install tasks before calling 783 // pages; and perform other extension install tasks before calling
780 // AddExtension. 784 // AddExtension.
781 void AddNewOrUpdatedExtension( 785 void AddNewOrUpdatedExtension(const extensions::Extension* extension,
782 const extensions::Extension* extension, 786 extensions::Extension::State initial_state,
783 const syncer::StringOrdinal& page_ordinal, 787 const syncer::StringOrdinal& page_ordinal);
784 extensions::Extension::State initial_state);
785 788
786 // Handles sending notification that |extension| was loaded. 789 // Handles sending notification that |extension| was loaded.
787 void NotifyExtensionLoaded(const extensions::Extension* extension); 790 void NotifyExtensionLoaded(const extensions::Extension* extension);
788 791
789 // Handles sending notification that |extension| was unloaded. 792 // Handles sending notification that |extension| was unloaded.
790 void NotifyExtensionUnloaded(const extensions::Extension* extension, 793 void NotifyExtensionUnloaded(const extensions::Extension* extension,
791 extension_misc::UnloadedExtensionReason reason); 794 extension_misc::UnloadedExtensionReason reason);
792 795
793 // Common helper to finish installing the given extension. 796 // Common helper to finish installing the given extension.
794 void FinishInstallation(const extensions::Extension* extension); 797 void FinishInstallation(const extensions::Extension* extension);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 841
839 // Helper to determine if an extension is idle, and it should be safe 842 // Helper to determine if an extension is idle, and it should be safe
840 // to update the extension. 843 // to update the extension.
841 bool IsExtensionIdle(const std::string& extension_id) const; 844 bool IsExtensionIdle(const std::string& extension_id) const;
842 845
843 // Helper to determine if updating an extensions should proceed immediately, 846 // Helper to determine if updating an extensions should proceed immediately,
844 // or if we should delay the update until further notice. 847 // or if we should delay the update until further notice.
845 bool ShouldDelayExtensionUpdate(const std::string& extension_id, 848 bool ShouldDelayExtensionUpdate(const std::string& extension_id,
846 bool wait_for_idle) const; 849 bool wait_for_idle) const;
847 850
851 // Helper to search storage directories for extensions with isolated storage
852 // that have been orphaned by an uninstall.
853 void GarbageCollectIsolatedStorage();
854 void OnGarbageCollectIsolatedStorageFinished();
855 void OnNeedsToGarbageCollectedIsolatedStorage();
856
848 // extensions::Blacklist::Observer implementation. 857 // extensions::Blacklist::Observer implementation.
849 virtual void OnBlacklistUpdated() OVERRIDE; 858 virtual void OnBlacklistUpdated() OVERRIDE;
850 859
851 // Manages the blacklisted extensions, intended as callback from 860 // Manages the blacklisted extensions, intended as callback from
852 // Blacklist::GetBlacklistedIDs. 861 // Blacklist::GetBlacklistedIDs.
853 void ManageBlacklist(const std::set<std::string>& old_blacklisted_ids, 862 void ManageBlacklist(const std::set<std::string>& old_blacklisted_ids,
854 const std::set<std::string>& new_blacklisted_ids); 863 const std::set<std::string>& new_blacklisted_ids);
855 864
865 // Controls if installs are delayed. See comment for |installs_delayed_|.
866 void set_installs_delayed(bool value) { installs_delayed_ = value; }
867 bool installs_delayed() const { return installs_delayed_; }
868
856 // The normal profile associated with this ExtensionService. 869 // The normal profile associated with this ExtensionService.
857 Profile* profile_; 870 Profile* profile_;
858 871
859 // The ExtensionSystem for the profile above. 872 // The ExtensionSystem for the profile above.
860 extensions::ExtensionSystem* system_; 873 extensions::ExtensionSystem* system_;
861 874
862 // Preferences for the owning profile. 875 // Preferences for the owning profile.
863 extensions::ExtensionPrefs* extension_prefs_; 876 extensions::ExtensionPrefs* extension_prefs_;
864 877
865 // Blacklist for the owning profile. 878 // Blacklist for the owning profile.
(...skipping 10 matching lines...) Expand all
876 889
877 // The list of installed extensions that have been terminated. 890 // The list of installed extensions that have been terminated.
878 ExtensionSet terminated_extensions_; 891 ExtensionSet terminated_extensions_;
879 892
880 // The list of installed extensions that have been blacklisted. Generally 893 // The list of installed extensions that have been blacklisted. Generally
881 // these shouldn't be considered as installed by the extension platform: we 894 // these shouldn't be considered as installed by the extension platform: we
882 // only keep them around so that if extensions are blacklisted by mistake 895 // only keep them around so that if extensions are blacklisted by mistake
883 // they can easily be un-blacklisted. 896 // they can easily be un-blacklisted.
884 ExtensionSet blacklisted_extensions_; 897 ExtensionSet blacklisted_extensions_;
885 898
886 // The list of extension updates that are waiting to be installed. 899 // The list of extension updates that have had their installs delayed because
887 ExtensionSet pending_extension_updates_; 900 // they are waiting for idle.
901 ExtensionSet delayed_for_idle_updates_;
Matt Perry 2012/12/08 01:55:33 nit: delayed_updates_for_idle_ (otherwise it sound
awong 2012/12/08 02:11:09 Done.
902
903 // The list of extension installs delayed by |installs_delayed_|.
904 // This is a disjoint set from |delayed_for_idle_updates_|. Extensions in
905 // the |delayed_installs_| do not need to wait for idle.
906 ExtensionSet delayed_installs_;
888 907
889 // Hold the set of pending extensions. 908 // Hold the set of pending extensions.
890 extensions::PendingExtensionManager pending_extension_manager_; 909 extensions::PendingExtensionManager pending_extension_manager_;
891 910
892 // The map of extension IDs to their runtime data. 911 // The map of extension IDs to their runtime data.
893 ExtensionRuntimeDataMap extension_runtime_data_; 912 ExtensionRuntimeDataMap extension_runtime_data_;
894 913
895 // The full path to the directory where extensions are installed. 914 // The full path to the directory where extensions are installed.
896 FilePath install_directory_; 915 FilePath install_directory_;
897 916
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 // has to wait for the external providers. Used in 1014 // has to wait for the external providers. Used in
996 // OnAllExternalProvidersReady() to determine if an update check is needed to 1015 // OnAllExternalProvidersReady() to determine if an update check is needed to
997 // install pending extensions. 1016 // install pending extensions.
998 bool update_once_all_providers_are_ready_; 1017 bool update_once_all_providers_are_ready_;
999 1018
1000 // Set when the browser is terminating. Prevents us from installing or 1019 // Set when the browser is terminating. Prevents us from installing or
1001 // updating additional extensions and allows in-progress installations to 1020 // updating additional extensions and allows in-progress installations to
1002 // decide to abort. 1021 // decide to abort.
1003 bool browser_terminating_; 1022 bool browser_terminating_;
1004 1023
1024 // Set to true to delay all new extension installations. Acts as a lock
1025 // to allow background processing of tasks such as garbage collection of
1026 // on-disk state without needing to worry about race conditions caused
1027 // by extension installation and reinstallation.
1028 bool installs_delayed_;
1029
1005 NaClModuleInfoList nacl_module_list_; 1030 NaClModuleInfoList nacl_module_list_;
1006 1031
1007 extensions::AppSyncBundle app_sync_bundle_; 1032 extensions::AppSyncBundle app_sync_bundle_;
1008 extensions::ExtensionSyncBundle extension_sync_bundle_; 1033 extensions::ExtensionSyncBundle extension_sync_bundle_;
1009 1034
1010 extensions::ProcessMap process_map_; 1035 extensions::ProcessMap process_map_;
1011 1036
1012 extensions::AppShortcutManager app_shortcut_manager_; 1037 extensions::AppShortcutManager app_shortcut_manager_;
1013 1038
1014 scoped_ptr<ExtensionErrorUI> extension_error_ui_; 1039 scoped_ptr<ExtensionErrorUI> extension_error_ui_;
1015 // Sequenced task runner for extension related file operations. 1040 // Sequenced task runner for extension related file operations.
1016 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; 1041 scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
1017 1042
1018 #if defined(ENABLE_EXTENSIONS) 1043 #if defined(ENABLE_EXTENSIONS)
1019 scoped_ptr<extensions::ExtensionActionStorageManager> 1044 scoped_ptr<extensions::ExtensionActionStorageManager>
1020 extension_action_storage_manager_; 1045 extension_action_storage_manager_;
1021 #endif 1046 #endif
1022 1047
1023 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 1048 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
1024 InstallAppsWithUnlimtedStorage); 1049 InstallAppsWithUnlimtedStorage);
1025 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 1050 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
1026 InstallAppsAndCheckStorageProtection); 1051 InstallAppsAndCheckStorageProtection);
1027 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 1052 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
1028 }; 1053 };
1029 1054
1030 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 1055 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698