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 // Download code which handles CRX files (extensions, themes, apps, ...). | 5 // Download code which handles CRX files (extensions, themes, apps, ...). |
6 | 6 |
7 #include "chrome/browser/download/download_util.h" | 7 #include "chrome/browser/download/download_util.h" |
8 #include "chrome/browser/extensions/crx_installer.h" | 8 #include "chrome/browser/extensions/crx_installer.h" |
9 #include "chrome/browser/extensions/extension_install_prompt.h" | 9 #include "chrome/browser/extensions/extension_install_prompt.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 ExtensionService* service = profile->GetExtensionService(); | 77 ExtensionService* service = profile->GetExtensionService(); |
78 CHECK(service); | 78 CHECK(service); |
79 | 79 |
80 scoped_refptr<extensions::CrxInstaller> installer( | 80 scoped_refptr<extensions::CrxInstaller> installer( |
81 extensions::CrxInstaller::Create( | 81 extensions::CrxInstaller::Create( |
82 service, | 82 service, |
83 CreateExtensionInstallPrompt(profile), | 83 CreateExtensionInstallPrompt(profile), |
84 WebstoreInstaller::GetAssociatedApproval(download_item))); | 84 WebstoreInstaller::GetAssociatedApproval(download_item))); |
85 | 85 |
| 86 installer->set_error_on_unsupported_requirements(true); |
86 installer->set_delete_source(true); | 87 installer->set_delete_source(true); |
87 installer->set_install_cause(extension_misc::INSTALL_CAUSE_USER_DOWNLOAD); | 88 installer->set_install_cause(extension_misc::INSTALL_CAUSE_USER_DOWNLOAD); |
88 | 89 |
89 if (OffStoreInstallAllowedByPrefs(profile, download_item)) { | 90 if (OffStoreInstallAllowedByPrefs(profile, download_item)) { |
90 installer->set_off_store_install_allow_reason( | 91 installer->set_off_store_install_allow_reason( |
91 extensions::CrxInstaller::OffStoreInstallAllowedBecausePref); | 92 extensions::CrxInstaller::OffStoreInstallAllowedBecausePref); |
92 } | 93 } |
93 | 94 |
94 if (extensions::UserScript::IsURLUserScript(download_item.GetURL(), | 95 if (extensions::UserScript::IsURLUserScript(download_item.GetURL(), |
95 download_item.GetMimeType())) { | 96 download_item.GetMimeType())) { |
(...skipping 23 matching lines...) Expand all Loading... |
119 if (download_item.GetMimeType() == extensions::Extension::kMimeType || | 120 if (download_item.GetMimeType() == extensions::Extension::kMimeType || |
120 extensions::UserScript::IsURLUserScript(download_item.GetURL(), | 121 extensions::UserScript::IsURLUserScript(download_item.GetURL(), |
121 download_item.GetMimeType())) { | 122 download_item.GetMimeType())) { |
122 return true; | 123 return true; |
123 } else { | 124 } else { |
124 return false; | 125 return false; |
125 } | 126 } |
126 } | 127 } |
127 | 128 |
128 } // namespace download_crx_util | 129 } // namespace download_crx_util |
OLD | NEW |