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 // Download utility implementation | 5 // Download utility implementation |
6 | 6 |
7 #include "chrome/browser/download/download_util.h" | 7 #include "chrome/browser/download/download_util.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <shobjidl.h> | 10 #include <shobjidl.h> |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 download_item.url()); | 288 download_item.url()); |
289 } else { | 289 } else { |
290 bool is_gallery_download = ExtensionsService::IsDownloadFromGallery( | 290 bool is_gallery_download = ExtensionsService::IsDownloadFromGallery( |
291 download_item.url(), download_item.referrer_url()); | 291 download_item.url(), download_item.referrer_url()); |
292 installer->set_original_mime_type(download_item.original_mime_type()); | 292 installer->set_original_mime_type(download_item.original_mime_type()); |
293 installer->set_apps_require_extension_mime_type(true); | 293 installer->set_apps_require_extension_mime_type(true); |
294 installer->set_allow_privilege_increase(true); | 294 installer->set_allow_privilege_increase(true); |
295 installer->set_original_url(download_item.url()); | 295 installer->set_original_url(download_item.url()); |
296 installer->set_limit_web_extent_to_download_host(!is_gallery_download); | 296 installer->set_limit_web_extent_to_download_host(!is_gallery_download); |
297 installer->InstallCrx(download_item.full_path()); | 297 installer->InstallCrx(download_item.full_path()); |
| 298 installer->set_allow_silent_install(is_gallery_download); |
298 } | 299 } |
299 } else { | 300 } else { |
300 TabContents* contents = NULL; | 301 TabContents* contents = NULL; |
301 // Get last active normal browser of profile. | 302 // Get last active normal browser of profile. |
302 Browser* last_active = | 303 Browser* last_active = |
303 BrowserList::FindBrowserWithType(profile, Browser::TYPE_NORMAL, true); | 304 BrowserList::FindBrowserWithType(profile, Browser::TYPE_NORMAL, true); |
304 if (last_active) | 305 if (last_active) |
305 contents = last_active->GetSelectedTabContents(); | 306 contents = last_active->GetSelectedTabContents(); |
306 if (contents) { | 307 if (contents) { |
307 contents->AddInfoBar( | 308 contents->AddInfoBar( |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 } | 760 } |
760 | 761 |
761 FilePath GetCrDownloadPath(const FilePath& suggested_path) { | 762 FilePath GetCrDownloadPath(const FilePath& suggested_path) { |
762 FilePath::StringType file_name; | 763 FilePath::StringType file_name; |
763 SStringPrintf(&file_name, PRFilePathLiteral FILE_PATH_LITERAL(".crdownload"), | 764 SStringPrintf(&file_name, PRFilePathLiteral FILE_PATH_LITERAL(".crdownload"), |
764 suggested_path.value().c_str()); | 765 suggested_path.value().c_str()); |
765 return FilePath(file_name); | 766 return FilePath(file_name); |
766 } | 767 } |
767 | 768 |
768 } // namespace download_util | 769 } // namespace download_util |
OLD | NEW |