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