| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // to be used to confirm permissions on a downloaded CRX. | 73 // to be used to confirm permissions on a downloaded CRX. |
| 74 void SetMockInstallPromptForTesting(ExtensionInstallPrompt* mock_prompt) { | 74 void SetMockInstallPromptForTesting(ExtensionInstallPrompt* mock_prompt) { |
| 75 mock_install_prompt_for_testing = mock_prompt; | 75 mock_install_prompt_for_testing = mock_prompt; |
| 76 } | 76 } |
| 77 | 77 |
| 78 scoped_refptr<extensions::CrxInstaller> OpenChromeExtension( | 78 scoped_refptr<extensions::CrxInstaller> OpenChromeExtension( |
| 79 Profile* profile, | 79 Profile* profile, |
| 80 const DownloadItem& download_item) { | 80 const DownloadItem& download_item) { |
| 81 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 81 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 82 | 82 |
| 83 ExtensionService* service = profile->GetExtensionService(); | 83 ExtensionService* service = extensions::ExtensionSystem::Get(profile)-> |
| 84 extension_service(); |
| 84 CHECK(service); | 85 CHECK(service); |
| 85 | 86 |
| 86 scoped_refptr<extensions::CrxInstaller> installer( | 87 scoped_refptr<extensions::CrxInstaller> installer( |
| 87 extensions::CrxInstaller::Create( | 88 extensions::CrxInstaller::Create( |
| 88 service, | 89 service, |
| 89 CreateExtensionInstallPrompt(profile, download_item), | 90 CreateExtensionInstallPrompt(profile, download_item), |
| 90 WebstoreInstaller::GetAssociatedApproval(download_item))); | 91 WebstoreInstaller::GetAssociatedApproval(download_item))); |
| 91 | 92 |
| 92 installer->set_error_on_unsupported_requirements(true); | 93 installer->set_error_on_unsupported_requirements(true); |
| 93 installer->set_delete_source(true); | 94 installer->set_delete_source(true); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 if (download_item.GetMimeType() == extensions::Extension::kMimeType || | 127 if (download_item.GetMimeType() == extensions::Extension::kMimeType || |
| 127 extensions::UserScript::IsURLUserScript(download_item.GetURL(), | 128 extensions::UserScript::IsURLUserScript(download_item.GetURL(), |
| 128 download_item.GetMimeType())) { | 129 download_item.GetMimeType())) { |
| 129 return true; | 130 return true; |
| 130 } else { | 131 } else { |
| 131 return false; | 132 return false; |
| 132 } | 133 } |
| 133 } | 134 } |
| 134 | 135 |
| 135 } // namespace download_crx_util | 136 } // namespace download_crx_util |
| OLD | NEW |