| OLD | NEW |
| 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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 creation_flags |= Extension::FROM_WEBSTORE; | 671 creation_flags |= Extension::FROM_WEBSTORE; |
| 672 } | 672 } |
| 673 | 673 |
| 674 // Bookmark apps being updated is kind of a contradiction, but that's because | 674 // Bookmark apps being updated is kind of a contradiction, but that's because |
| 675 // we mark the default apps as bookmark apps, and they're hosted in the web | 675 // we mark the default apps as bookmark apps, and they're hosted in the web |
| 676 // store, thus they can get updated. See http://crbug.com/101605 for more | 676 // store, thus they can get updated. See http://crbug.com/101605 for more |
| 677 // details. | 677 // details. |
| 678 if (extension && extension->from_bookmark()) | 678 if (extension && extension->from_bookmark()) |
| 679 creation_flags |= Extension::FROM_BOOKMARK; | 679 creation_flags |= Extension::FROM_BOOKMARK; |
| 680 | 680 |
| 681 if (extension) { | |
| 682 // Additionally, if the extension is an external extension, we preserve the | |
| 683 // creation flags (usually from_bookmark), even if the current pref values | |
| 684 // don't reflect them. This is to fix http://crbug.com/109791 for users that | |
| 685 // had default apps updated and lost the from_bookmark bit. | |
| 686 ProviderCollection::const_iterator i; | |
| 687 for (i = external_extension_providers_.begin(); | |
| 688 i != external_extension_providers_.end(); ++i) { | |
| 689 ExternalExtensionProviderInterface* provider = i->get(); | |
| 690 if (provider->HasExtension(extension->id())) { | |
| 691 creation_flags |= provider->GetCreationFlags(); | |
| 692 break; | |
| 693 } | |
| 694 } | |
| 695 } | |
| 696 installer->set_creation_flags(creation_flags); | 681 installer->set_creation_flags(creation_flags); |
| 697 | 682 |
| 698 installer->set_delete_source(true); | 683 installer->set_delete_source(true); |
| 699 installer->set_download_url(download_url); | 684 installer->set_download_url(download_url); |
| 700 installer->set_install_cause(extension_misc::INSTALL_CAUSE_UPDATE); | 685 installer->set_install_cause(extension_misc::INSTALL_CAUSE_UPDATE); |
| 701 installer->InstallCrx(extension_path); | 686 installer->InstallCrx(extension_path); |
| 702 | 687 |
| 703 if (out_crx_installer) | 688 if (out_crx_installer) |
| 704 *out_crx_installer = installer; | 689 *out_crx_installer = installer; |
| 705 | 690 |
| (...skipping 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2650 // To coexist with certain unit tests that don't have an IO thread message | 2635 // To coexist with certain unit tests that don't have an IO thread message |
| 2651 // loop available at ExtensionService shutdown, we lazy-initialize this | 2636 // loop available at ExtensionService shutdown, we lazy-initialize this |
| 2652 // object so that those cases neither create nor destroy an | 2637 // object so that those cases neither create nor destroy an |
| 2653 // APIResourceController. | 2638 // APIResourceController. |
| 2654 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 2639 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 2655 if (!api_resource_controller_) { | 2640 if (!api_resource_controller_) { |
| 2656 api_resource_controller_ = new extensions::APIResourceController(); | 2641 api_resource_controller_ = new extensions::APIResourceController(); |
| 2657 } | 2642 } |
| 2658 return api_resource_controller_; | 2643 return api_resource_controller_; |
| 2659 } | 2644 } |
| OLD | NEW |