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_ui.h" | 9 #include "chrome/browser/extensions/extension_install_ui.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 if (is_gallery_download) | 80 if (is_gallery_download) |
81 installer->set_original_download_url(download_item.GetOriginalUrl()); | 81 installer->set_original_download_url(download_item.GetOriginalUrl()); |
82 installer->set_allow_silent_install(is_gallery_download); | 82 installer->set_allow_silent_install(is_gallery_download); |
83 installer->set_install_cause(extension_misc::INSTALL_CAUSE_USER_DOWNLOAD); | 83 installer->set_install_cause(extension_misc::INSTALL_CAUSE_USER_DOWNLOAD); |
84 installer->InstallCrx(download_item.GetFullPath()); | 84 installer->InstallCrx(download_item.GetFullPath()); |
85 } | 85 } |
86 | 86 |
87 return installer; | 87 return installer; |
88 } | 88 } |
89 | 89 |
| 90 bool IsExtensionDownload(const DownloadItem& download_item) { |
| 91 if (download_item.PromptUserForSaveLocation()) |
| 92 return false; |
| 93 |
| 94 if (download_item.GetMimeType() == extensions::Extension::kMimeType || |
| 95 UserScript::IsURLUserScript(download_item.GetURL(), |
| 96 download_item.GetMimeType())) { |
| 97 return true; |
| 98 } else { |
| 99 return false; |
| 100 } |
| 101 } |
| 102 |
90 } // namespace download_crx_util | 103 } // namespace download_crx_util |
OLD | NEW |