| 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 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 } | 415 } |
| 416 | 416 |
| 417 // Create the download file and start the download. | 417 // Create the download file and start the download. |
| 418 scoped_ptr<DownloadFile> download_file( | 418 scoped_ptr<DownloadFile> download_file( |
| 419 file_factory_->CreateFile( | 419 file_factory_->CreateFile( |
| 420 info->save_info.Pass(), default_download_directory, | 420 info->save_info.Pass(), default_download_directory, |
| 421 info->url(), info->referrer_url, | 421 info->url(), info->referrer_url, |
| 422 delegate_->GenerateFileHash(), | 422 delegate_->GenerateFileHash(), |
| 423 stream.Pass(), download->GetBoundNetLog(), | 423 stream.Pass(), download->GetBoundNetLog(), |
| 424 download->DestinationObserverAsWeakPtr())); | 424 download->DestinationObserverAsWeakPtr())); |
| 425 |
| 426 // Attach the client ID identifying the app to the AV system. |
| 427 if (download_file.get() && delegate_) { |
| 428 download_file->SetClientGuid( |
| 429 delegate_->ApplicationClientIdForFileScanning()); |
| 430 } |
| 431 |
| 425 scoped_ptr<DownloadRequestHandleInterface> req_handle( | 432 scoped_ptr<DownloadRequestHandleInterface> req_handle( |
| 426 new DownloadRequestHandle(info->request_handle)); | 433 new DownloadRequestHandle(info->request_handle)); |
| 427 download->Start(download_file.Pass(), req_handle.Pass()); | 434 download->Start(download_file.Pass(), req_handle.Pass()); |
| 428 | 435 |
| 429 // For interrupted downloads, Start() will transition the state to | 436 // For interrupted downloads, Start() will transition the state to |
| 430 // IN_PROGRESS and consumers will be notified via OnDownloadUpdated(). | 437 // IN_PROGRESS and consumers will be notified via OnDownloadUpdated(). |
| 431 // For new downloads, we notify here, rather than earlier, so that | 438 // For new downloads, we notify here, rather than earlier, so that |
| 432 // the download_file is bound to download and all the usual | 439 // the download_file is bound to download and all the usual |
| 433 // setters (e.g. Cancel) work. | 440 // setters (e.g. Cancel) work. |
| 434 if (new_download) | 441 if (new_download) |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 if (delegate_) | 698 if (delegate_) |
| 692 delegate_->OpenDownload(download); | 699 delegate_->OpenDownload(download); |
| 693 } | 700 } |
| 694 | 701 |
| 695 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { | 702 void DownloadManagerImpl::ShowDownloadInShell(DownloadItemImpl* download) { |
| 696 if (delegate_) | 703 if (delegate_) |
| 697 delegate_->ShowDownloadInShell(download); | 704 delegate_->ShowDownloadInShell(download); |
| 698 } | 705 } |
| 699 | 706 |
| 700 } // namespace content | 707 } // namespace content |
| OLD | NEW |