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 #include "content/browser/download/download_manager_impl.h" | 5 #include "content/browser/download/download_manager_impl.h" |
6 | 6 |
7 #include <iterator> | 7 #include <iterator> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 } | 354 } |
355 download = item_iterator->second.get(); | 355 download = item_iterator->second.get(); |
356 } | 356 } |
357 | 357 |
358 base::FilePath default_download_directory; | 358 base::FilePath default_download_directory; |
359 if (delegate_) { | 359 if (delegate_) { |
360 base::FilePath website_save_directory; // Unused | 360 base::FilePath website_save_directory; // Unused |
361 bool skip_dir_check = false; // Unused | 361 bool skip_dir_check = false; // Unused |
362 delegate_->GetSaveDir(GetBrowserContext(), &website_save_directory, | 362 delegate_->GetSaveDir(GetBrowserContext(), &website_save_directory, |
363 &default_download_directory, &skip_dir_check); | 363 &default_download_directory, &skip_dir_check); |
| 364 if (delegate_->ShouldBlockAllDownloads()) |
| 365 info->result = DOWNLOAD_INTERRUPT_REASON_FILE_BLOCKED; |
364 } | 366 } |
365 | 367 |
366 std::unique_ptr<DownloadFile> download_file; | 368 std::unique_ptr<DownloadFile> download_file; |
367 | 369 |
368 if (info->result == DOWNLOAD_INTERRUPT_REASON_NONE) { | 370 if (info->result == DOWNLOAD_INTERRUPT_REASON_NONE) { |
369 DCHECK(stream.get()); | 371 DCHECK(stream.get()); |
370 download_file.reset(file_factory_->CreateFile( | 372 download_file.reset(file_factory_->CreateFile( |
371 std::move(info->save_info), default_download_directory, | 373 std::move(info->save_info), default_download_directory, |
372 std::move(stream), download->GetNetLogWithSource(), | 374 std::move(stream), download->GetNetLogWithSource(), |
373 download->DestinationObserverAsWeakPtr())); | 375 download->DestinationObserverAsWeakPtr())); |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 if (delegate_) | 735 if (delegate_) |
734 delegate_->OpenDownload(download); | 736 delegate_->OpenDownload(download); |
735 } | 737 } |
736 | 738 |
737 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { | 739 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { |
738 if (delegate_) | 740 if (delegate_) |
739 delegate_->ShowDownloadInShell(download); | 741 delegate_->ShowDownloadInShell(download); |
740 } | 742 } |
741 | 743 |
742 } // namespace content | 744 } // namespace content |
OLD | NEW |