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

Unified Diff: chrome/browser/extensions/extension_service.cc

Issue 9817018: Cleaning Up Extensions When Local Content Removed (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Pulled garbage collection into its own class. Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index 6923e15d854cedb5979ac5ab97de410f9f1b257a..93b76d8ef4acca04d9f67b1c63cd7a3cd5af8a70 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -112,7 +112,6 @@
#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
@@ -378,6 +377,7 @@ ExtensionService::ExtensionService(Profile* profile,
bool extensions_enabled)
: profile_(profile),
extension_prefs_(extension_prefs),
+ extension_garbage_collector_(new ExtensionGarbageCollector(this)),
settings_frontend_(extensions::SettingsFrontend::Create(profile)),
pending_extension_manager_(*ALLOW_THIS_IN_INITIALIZER_LIST(this)),
install_directory_(install_directory),
@@ -1894,7 +1894,7 @@ void ExtensionService::UnloadExtension(
// Clean up runtime data.
extension_runtime_data_.erase(extension_id);
-if (disabled_extensions_.Contains(extension->id())) {
+ if (disabled_extensions_.Contains(extension->id())) {
UnloadedExtensionInfo details(extension, reason);
details.already_disabled = true;
disabled_extensions_.Remove(extension->id());
@@ -1936,23 +1936,7 @@ void ExtensionService::ReloadExtensions() {
}
void ExtensionService::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();
+ extension_garbage_collector_->GarbageCollectExtensions();
// Also garbage-collect themes. We check |profile_| to be
// defensive; in the future, we may call GarbageCollectExtensions()
@@ -2133,7 +2117,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(extension->version()->CompareTo(*(old->version())) >= 0);
+ CHECK_GE(extension->version()->CompareTo(*(old->version())), 0);
// Extensions get upgraded if the privileges are allowed to increase or
// the privileges haven't increased.

Powered by Google App Engine
This is Rietveld 408576698