diff options
author | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-19 19:17:47 +0000 |
---|---|---|
committer | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-19 19:17:47 +0000 |
commit | 2f8757c314dbae44b10fa19f15d1ccf69361680f (patch) | |
tree | 92081b1c26e05981198331cb7143a2facf355ec6 /chrome/browser/extensions/extension_service.cc | |
parent | 06c7dacb8a9e610da95b7a5bc5b5d2458b430b3d (diff) | |
download | chromium_src-2f8757c314dbae44b10fa19f15d1ccf69361680f.zip chromium_src-2f8757c314dbae44b10fa19f15d1ccf69361680f.tar.gz chromium_src-2f8757c314dbae44b10fa19f15d1ccf69361680f.tar.bz2 |
Revert 142427 - Cleaning Up Extensions When Local Content Removed
Reverted because unpacked extensions appear to unintentionally get removed: crbug.com/133381.
This fixes an issue where removing an extension's local content, e.g. deleting
the user-data-dir/Default/Extensions/<id> directory, would result in a broken
extension. Chrome will now uninstall/remove any extensions where the path to
the extension cannot be resolved.
BUG=31910
TEST=ExtensionServiceTest.CleanupInternalExtensionsMissingLocalContent;
ExtensionServiceTest.CleanupUnpackedExtensionsMissingLocalContent;
test by hand by loading an extension, deleting the local directory, and
restarting chrome
Review URL: https://chromiumcodereview.appspot.com/10541126
TBR=rdevlin.cronin@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10581021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143012 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_service.cc')
-rw-r--r-- | chrome/browser/extensions/extension_service.cc | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc index 710643b..f4063bc 100644 --- a/chrome/browser/extensions/extension_service.cc +++ b/chrome/browser/extensions/extension_service.cc @@ -119,6 +119,7 @@ #include "chrome/browser/chromeos/extensions/input_method_event_router.h" #include "chrome/browser/chromeos/extensions/media_player_event_router.h" #include "chrome/browser/chromeos/input_method/input_method_manager.h" +#include "chrome/browser/extensions/extension_input_ime_api.h" #include "webkit/fileapi/file_system_context.h" #include "webkit/fileapi/file_system_mount_point_provider.h" #endif @@ -324,8 +325,6 @@ ExtensionService::ExtensionService(Profile* profile, : profile_(profile), system_(ExtensionSystem::Get(profile)), extension_prefs_(extension_prefs), - extension_garbage_collector_( - new extensions::ExtensionGarbageCollector(this)), settings_frontend_(extensions::SettingsFrontend::Create(profile)), pending_extension_manager_(*ALLOW_THIS_IN_INITIALIZER_LIST(this)), install_directory_(install_directory), @@ -1847,7 +1846,23 @@ void ExtensionService::ReloadExtensions() { } void ExtensionService::GarbageCollectExtensions() { - extension_garbage_collector_->GarbageCollectExtensions(); + if (extension_prefs_->pref_service()->ReadOnly()) + return; + + scoped_ptr<ExtensionPrefs::ExtensionsInfo> info( + extension_prefs_->GetInstalledExtensionsInfo()); + + std::map<std::string, FilePath> extension_paths; + for (size_t i = 0; i < info->size(); ++i) + extension_paths[info->at(i)->extension_id] = info->at(i)->extension_path; + + if (!BrowserThread::PostTask( + BrowserThread::FILE, FROM_HERE, + base::Bind( + &extension_file_util::GarbageCollectExtensions, + install_directory_, + extension_paths))) + NOTREACHED(); // Also garbage-collect themes. We check |profile_| to be // defensive; in the future, we may call GarbageCollectExtensions() @@ -2013,7 +2028,7 @@ void ExtensionService::InitializePermissions(const Extension* extension) { // Other than for unpacked extensions, CrxInstaller should have guaranteed // that we aren't downgrading. if (extension->location() != Extension::LOAD) - CHECK_GE(extension->version()->CompareTo(*(old->version())), 0); + CHECK(extension->version()->CompareTo(*(old->version())) >= 0); // Extensions get upgraded if the privileges are allowed to increase or // the privileges haven't increased. |