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

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

Issue 10834191: new implementation of default apps (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: comments Created 8 years, 4 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 485eb6be7af64b6c48c0f2856f161158fd63c07e..239d6f9d715a4a4d42203c9cd2d8cf719129b598 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -2277,25 +2277,36 @@ bool ExtensionService::OnExternalExtensionFileFound(
if (extension_prefs_->IsExternalExtensionUninstalled(id))
return false;
- DCHECK(version);
-
// Before even bothering to unpack, check and see if we already have this
// version. This is important because these extensions are going to get
// installed on every startup.
const Extension* existing = GetExtensionById(id, true);
+
if (existing) {
- switch (existing->version()->CompareTo(*version)) {
- case -1: // existing version is older, we should upgrade
- break;
- case 0: // existing version is same, do nothing
- return false;
- case 1: // existing version is newer, uh-oh
- LOG(WARNING) << "Found external version of extension " << id
- << "that is older than current version. Current version "
- << "is: " << existing->VersionString() << ". New version "
- << "is: " << version->GetString()
- << ". Keeping current version.";
- return false;
+ // The default apps will have the location set as INTERNAL. Since older
+ // default apps are installed as EXTERNAL, we override them. However, if the
+ // app is already installed as internal, then do the version check.
+ // TODO (grv) : Remove after Q1-2013.
+ bool is_default_apps_migration =
+ (location == Extension::INTERNAL &&
+ Extension::IsExternalLocation(existing->location()));
+
+ if (!is_default_apps_migration) {
+ DCHECK(version);
+
+ switch (existing->version()->CompareTo(*version)) {
+ case -1: // existing version is older, we should upgrade
+ break;
+ case 0: // existing version is same, do nothing
+ return false;
+ case 1: // existing version is newer, uh-oh
+ LOG(WARNING) << "Found external version of extension " << id
+ << "that is older than current version. Current version "
+ << "is: " << existing->VersionString() << ". New "
+ << "version is: " << version->GetString()
+ << ". Keeping current version.";
+ return false;
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698