OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extensions_service.h" | 5 #include "chrome/browser/extensions/extensions_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 } | 746 } |
747 | 747 |
748 void ExtensionsService::AddPendingExtensionInternal( | 748 void ExtensionsService::AddPendingExtensionInternal( |
749 const std::string& id, const GURL& update_url, | 749 const std::string& id, const GURL& update_url, |
750 PendingExtensionInfo::ExpectedCrxType expected_crx_type, | 750 PendingExtensionInfo::ExpectedCrxType expected_crx_type, |
751 bool is_from_sync, bool install_silently, | 751 bool is_from_sync, bool install_silently, |
752 bool enable_on_install, bool enable_incognito_on_install, | 752 bool enable_on_install, bool enable_incognito_on_install, |
753 Extension::Location install_source) { | 753 Extension::Location install_source) { |
754 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 754 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
755 | 755 |
| 756 // If a non-sync update is pending, a sync request should not |
| 757 // overwrite it. This is important for external extensions. |
| 758 // If an external extension download is pending, and the user has |
| 759 // the extension in their sync profile, the install should set the |
| 760 // type to be external. An external extension should not be |
| 761 // rejected if it fails the safty checks for a syncable extension. |
| 762 // TODO(skerner): Work out other potential overlapping conditions. |
| 763 // (crbug/61000) |
| 764 PendingExtensionMap::iterator it = pending_extensions_.find(id); |
| 765 if (it != pending_extensions_.end()) { |
| 766 VLOG(1) << "Extension id " << id |
| 767 << " was entered for update more than once." |
| 768 << " old is_from_sync = " << it->second.is_from_sync |
| 769 << " new is_from_sync = " << is_from_sync; |
| 770 if (!it->second.is_from_sync && is_from_sync) |
| 771 return; |
| 772 } |
| 773 |
| 774 |
756 pending_extensions_[id] = | 775 pending_extensions_[id] = |
757 PendingExtensionInfo(update_url, expected_crx_type, is_from_sync, | 776 PendingExtensionInfo(update_url, expected_crx_type, is_from_sync, |
758 install_silently, enable_on_install, | 777 install_silently, enable_on_install, |
759 enable_incognito_on_install, install_source); | 778 enable_incognito_on_install, install_source); |
760 } | 779 } |
761 | 780 |
762 void ExtensionsService::ReloadExtension(const std::string& extension_id) { | 781 void ExtensionsService::ReloadExtension(const std::string& extension_id) { |
763 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 782 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
764 FilePath path; | 783 FilePath path; |
765 const Extension* current_extension = GetExtensionById(extension_id, false); | 784 const Extension* current_extension = GetExtensionById(extension_id, false); |
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1871 ExtensionIdSet ExtensionsService::GetAppIds() const { | 1890 ExtensionIdSet ExtensionsService::GetAppIds() const { |
1872 ExtensionIdSet result; | 1891 ExtensionIdSet result; |
1873 for (ExtensionList::const_iterator it = extensions_.begin(); | 1892 for (ExtensionList::const_iterator it = extensions_.begin(); |
1874 it != extensions_.end(); ++it) { | 1893 it != extensions_.end(); ++it) { |
1875 if ((*it)->is_app() && (*it)->location() != Extension::COMPONENT) | 1894 if ((*it)->is_app() && (*it)->location() != Extension::COMPONENT) |
1876 result.insert((*it)->id()); | 1895 result.insert((*it)->id()); |
1877 } | 1896 } |
1878 | 1897 |
1879 return result; | 1898 return result; |
1880 } | 1899 } |
OLD | NEW |