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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 PendingExtensionMap::iterator it = pending_extensions_.find(id); | 761 PendingExtensionMap::iterator it = pending_extensions_.find(id); |
762 if (it != pending_extensions_.end()) { | 762 if (it != pending_extensions_.end()) { |
763 VLOG(1) << "Extension id " << id | 763 VLOG(1) << "Extension id " << id |
764 << " was entered for update more than once." | 764 << " was entered for update more than once." |
765 << " old is_from_sync = " << it->second.is_from_sync | 765 << " old is_from_sync = " << it->second.is_from_sync |
766 << " new is_from_sync = " << is_from_sync; | 766 << " new is_from_sync = " << is_from_sync; |
767 if (!it->second.is_from_sync && is_from_sync) | 767 if (!it->second.is_from_sync && is_from_sync) |
768 return; | 768 return; |
769 } | 769 } |
770 | 770 |
771 | |
772 pending_extensions_[id] = | 771 pending_extensions_[id] = |
773 PendingExtensionInfo(update_url, expected_crx_type, is_from_sync, | 772 PendingExtensionInfo(update_url, expected_crx_type, is_from_sync, |
774 install_silently, enable_on_install, | 773 install_silently, enable_on_install, |
775 enable_incognito_on_install, install_source); | 774 enable_incognito_on_install, install_source); |
776 } | 775 } |
777 | 776 |
778 void ExtensionsService::ReloadExtension(const std::string& extension_id) { | 777 void ExtensionsService::ReloadExtension(const std::string& extension_id) { |
779 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 778 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
780 FilePath path; | 779 FilePath path; |
781 Extension* current_extension = GetExtensionById(extension_id, false); | 780 Extension* current_extension = GetExtensionById(extension_id, false); |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1791 return; | 1790 return; |
1792 case 1: // existing version is newer, uh-oh | 1791 case 1: // existing version is newer, uh-oh |
1793 LOG(WARNING) << "Found external version of extension " << id | 1792 LOG(WARNING) << "Found external version of extension " << id |
1794 << "that is older than current version. Current version " | 1793 << "that is older than current version. Current version " |
1795 << "is: " << existing->VersionString() << ". New version " | 1794 << "is: " << existing->VersionString() << ". New version " |
1796 << "is: " << version << ". Keeping current version."; | 1795 << "is: " << version << ". Keeping current version."; |
1797 return; | 1796 return; |
1798 } | 1797 } |
1799 } | 1798 } |
1800 | 1799 |
| 1800 GURL update_url = GURL(); |
| 1801 PendingExtensionInfo::ExpectedCrxType expected_crx_type = |
| 1802 PendingExtensionInfo::UNKNOWN; |
| 1803 bool is_from_sync = false; |
| 1804 bool install_silently = true; |
| 1805 bool enable_on_install = true; |
| 1806 bool enable_incognito_on_install = false; |
| 1807 pending_extensions_[id] = PendingExtensionInfo( |
| 1808 update_url, |
| 1809 expected_crx_type, |
| 1810 is_from_sync, |
| 1811 install_silently, |
| 1812 enable_on_install, |
| 1813 enable_incognito_on_install, |
| 1814 location); |
| 1815 |
1801 scoped_refptr<CrxInstaller> installer( | 1816 scoped_refptr<CrxInstaller> installer( |
1802 new CrxInstaller(install_directory_, | 1817 new CrxInstaller(install_directory_, |
1803 this, // frontend | 1818 this, // frontend |
1804 NULL)); // no client (silent install) | 1819 NULL)); // no client (silent install) |
1805 installer->set_install_source(location); | 1820 installer->set_install_source(location); |
1806 installer->set_expected_id(id); | 1821 installer->set_expected_id(id); |
1807 installer->set_allow_privilege_increase(true); | 1822 installer->set_allow_privilege_increase(true); |
1808 installer->InstallCrx(path); | 1823 installer->InstallCrx(path); |
1809 } | 1824 } |
1810 | 1825 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1891 ExtensionIdSet ExtensionsService::GetAppIds() const { | 1906 ExtensionIdSet ExtensionsService::GetAppIds() const { |
1892 ExtensionIdSet result; | 1907 ExtensionIdSet result; |
1893 for (ExtensionList::const_iterator it = extensions_.begin(); | 1908 for (ExtensionList::const_iterator it = extensions_.begin(); |
1894 it != extensions_.end(); ++it) { | 1909 it != extensions_.end(); ++it) { |
1895 if ((*it)->is_app() && (*it)->location() != Extension::COMPONENT) | 1910 if ((*it)->is_app() && (*it)->location() != Extension::COMPONENT) |
1896 result.insert((*it)->id()); | 1911 result.insert((*it)->id()); |
1897 } | 1912 } |
1898 | 1913 |
1899 return result; | 1914 return result; |
1900 } | 1915 } |
OLD | NEW |