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

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: fixed broken test 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 6425c251fc1699da0aa5feab1ac590a19d973280..74f1676d1dd728ca667703c796bacc62276e60dd 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -2261,13 +2261,19 @@ 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) {
+
+ // 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.
+ if (existing && (location != Extension::INTERNAL ||
Mihai Parparita -not on Chrome 2012/08/15 00:32:13 I found this boolean expression hard to read becau
+ !Extension::IsExternalLocation(existing->location()))) {
+
+ DCHECK(version);
+
switch (existing->version()->CompareTo(*version)) {
case -1: // existing version is older, we should upgrade
break;
@@ -2276,8 +2282,8 @@ bool ExtensionService::OnExternalExtensionFileFound(
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()
+ << "is: " << existing->VersionString() << ". New "
+ << "version is: " << version->GetString()
<< ". Keeping current version.";
return false;
}

Powered by Google App Engine
This is Rietveld 408576698