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

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

Issue 9133023: Fix default apps losing the "bookmark app" bit once they get updated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix from_webstore Created 8 years, 11 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 c69cd61293ce4165ee49c18f91f19471670749f9..faaf3fd52ce6186a963b12ffa77a73a02ea1e0e5 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -642,11 +642,38 @@ bool ExtensionService::UpdateExtension(
// webstore, treat it as a webstore install. Note that we ignore some older
// extensions with blank auto-update URLs because we are mostly concerned
// with restrictions on NaCl extensions, which are newer.
+ int creation_flags = Extension::NO_FLAGS;
if ((extension && extension->from_webstore()) ||
(!extension && pending_extension_info.is_from_sync() &&
extension_urls::IsWebstoreUpdateUrl(
- pending_extension_info.update_url())))
- installer->set_is_gallery_install(true);
+ pending_extension_info.update_url()))) {
+ creation_flags |= Extension::FROM_WEBSTORE;
+ }
+
+ // Bookmark apps being updated is kind of a contradiction, but that's because
+ // we mark the default apps as bookmark apps, and they're hosted in the web
+ // store, thus they can get updated. See http://crbug.com/101605 for more
+ // details.
+ if (extension && extension->from_bookmark())
+ creation_flags |= Extension::FROM_BOOKMARK;
+
+ if (extension) {
+ // Additionally, if the extension is an external extension, we preserve the
+ // creation flags (usually from_bookmark), even if the current pref values
+ // don't reflect them. This is to fix http://crbug.com/109791 for users that
+ // had default apps updated and lost the from_bookmark bit.
+ ProviderCollection::const_iterator i;
+ for (i = external_extension_providers_.begin();
+ i != external_extension_providers_.end(); ++i) {
+ ExternalExtensionProviderInterface* provider = i->get();
+ if (provider->HasExtension(extension->id())) {
+ creation_flags |= provider->creation_flags();
+ break;
+ }
+ }
+ }
+ installer->set_creation_flags(creation_flags);
+
installer->set_delete_source(true);
installer->set_download_url(download_url);
installer->set_install_cause(extension_misc::INSTALL_CAUSE_UPDATE);

Powered by Google App Engine
This is Rietveld 408576698