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

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

Issue 7237028: Reinstall extensions if they become policy-controlled (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_service.cc
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index b5b7ae9f2abba597de3beb72a565ba886c4efee7..f717c608bc34529c918f8b957bbf4bd1f4332c45 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -410,9 +410,20 @@ void ExtensionService::OnExternalExtensionUpdateUrlFound(
CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
CHECK(Extension::IdIsValid(id));
- if (GetExtensionById(id, true)) {
- // Already installed. Do not change the update URL that the extension set.
- return;
+ const Extension* extension = GetExtensionById(id, true);
+ if (extension) {
+ if (location != extension->location() &&
Sam Kerner (Chrome) 2011/06/24 20:03:34 Uninstalling wipes any extension state in localsto
gfeher 2011/06/27 12:59:49 Your comment got me thinking. In the case you desc
Sam Kerner (Chrome) 2011/06/27 14:26:30 Yes, we can't do the right thing here without some
+ location == Extension::EXTERNAL_POLICY_DOWNLOAD) {
+ // Already installed, but not as a policy controlled extension.
+ // Trigger a reainstall to make its location right, and thus disable its
+ // manual uninstall.
+ std::string error;
+ UninstallExtension(extension->id(), false, &error);
+ } else {
+ // Already installed. Do not change the update URL that the extension
+ // set.
+ return;
+ }
}
pending_extension_manager()->AddFromExternalUpdateUrl(
id, update_url, location);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698