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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 if (is_pending_extension) 635 if (is_pending_extension)
636 installer->set_install_source(pending_extension_info.install_source()); 636 installer->set_install_source(pending_extension_info.install_source());
637 else if (extension) 637 else if (extension)
638 installer->set_install_source(extension->location()); 638 installer->set_install_source(extension->location());
639 if (pending_extension_info.install_silently()) 639 if (pending_extension_info.install_silently())
640 installer->set_allow_silent_install(true); 640 installer->set_allow_silent_install(true);
641 // If the extension came from sync and its auto-update URL is from the 641 // If the extension came from sync and its auto-update URL is from the
642 // webstore, treat it as a webstore install. Note that we ignore some older 642 // webstore, treat it as a webstore install. Note that we ignore some older
643 // extensions with blank auto-update URLs because we are mostly concerned 643 // extensions with blank auto-update URLs because we are mostly concerned
644 // with restrictions on NaCl extensions, which are newer. 644 // with restrictions on NaCl extensions, which are newer.
645 int creation_flags = Extension::NO_FLAGS;
645 if ((extension && extension->from_webstore()) || 646 if ((extension && extension->from_webstore()) ||
646 (!extension && pending_extension_info.is_from_sync() && 647 (!extension && pending_extension_info.is_from_sync() &&
647 extension_urls::IsWebstoreUpdateUrl( 648 extension_urls::IsWebstoreUpdateUrl(
648 pending_extension_info.update_url()))) 649 pending_extension_info.update_url()))) {
649 installer->set_is_gallery_install(true); 650 creation_flags |= Extension::FROM_WEBSTORE;
651 }
652
653 // Bookmark apps being updated is kind of a contradiction, but that's because
654 // we mark the default apps as bookmark apps, and they're hosted in the web
655 // store, thus they can get updated. See http://crbug.com/101605 for more
656 // details.
657 if (extension && extension->from_bookmark())
658 creation_flags |= Extension::FROM_BOOKMARK;
659
660 if (extension) {
661 // Additionally, if the extension is an external extension, we preserve the
662 // creation flags (usually from_bookmark), even if the current pref values
663 // don't reflect them. This is to fix http://crbug.com/109791 for users that
664 // had default apps updated and lost the from_bookmark bit.
665 ProviderCollection::const_iterator i;
666 for (i = external_extension_providers_.begin();
667 i != external_extension_providers_.end(); ++i) {
668 ExternalExtensionProviderInterface* provider = i->get();
669 if (provider->HasExtension(extension->id())) {
670 creation_flags |= provider->creation_flags();
671 break;
672 }
673 }
674 }
675 installer->set_creation_flags(creation_flags);
676
650 installer->set_delete_source(true); 677 installer->set_delete_source(true);
651 installer->set_download_url(download_url); 678 installer->set_download_url(download_url);
652 installer->set_install_cause(extension_misc::INSTALL_CAUSE_UPDATE); 679 installer->set_install_cause(extension_misc::INSTALL_CAUSE_UPDATE);
653 installer->InstallCrx(extension_path); 680 installer->InstallCrx(extension_path);
654 681
655 if (out_crx_installer) 682 if (out_crx_installer)
656 *out_crx_installer = installer; 683 *out_crx_installer = installer;
657 684
658 return true; 685 return true;
659 } 686 }
(...skipping 2000 matching lines...) Expand 10 before | Expand all | Expand 10 after
2660 // 2687 //
2661 // To coexist with certain unit tests that don't have an IO thread message 2688 // To coexist with certain unit tests that don't have an IO thread message
2662 // loop available at ExtensionService shutdown, we lazy-initialize this 2689 // loop available at ExtensionService shutdown, we lazy-initialize this
2663 // object so that those cases neither create nor destroy a SocketController. 2690 // object so that those cases neither create nor destroy a SocketController.
2664 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 2691 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
2665 if (!socket_controller_) { 2692 if (!socket_controller_) {
2666 socket_controller_ = new extensions::SocketController(); 2693 socket_controller_ = new extensions::SocketController();
2667 } 2694 }
2668 return socket_controller_; 2695 return socket_controller_;
2669 } 2696 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698