| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/download/download_manager.h" | 5 #include "chrome/browser/download/download_manager.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 | 1007 |
| 1008 void DownloadManager::DownloadUrlToFile(const GURL& url, | 1008 void DownloadManager::DownloadUrlToFile(const GURL& url, |
| 1009 const GURL& referrer, | 1009 const GURL& referrer, |
| 1010 const std::string& referrer_charset, | 1010 const std::string& referrer_charset, |
| 1011 const DownloadSaveInfo& save_info, | 1011 const DownloadSaveInfo& save_info, |
| 1012 TabContents* tab_contents) { | 1012 TabContents* tab_contents) { |
| 1013 DCHECK(tab_contents); | 1013 DCHECK(tab_contents); |
| 1014 // We send a pointer to content::ResourceContext, instead of the usual | 1014 // We send a pointer to content::ResourceContext, instead of the usual |
| 1015 // reference, so that a copy of the object isn't made. | 1015 // reference, so that a copy of the object isn't made. |
| 1016 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 1016 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 1017 NewRunnableFunction(&download_util::DownloadUrl, | 1017 NewRunnableFunction( |
| 1018 url, | 1018 &download_util::DownloadUrl, |
| 1019 referrer, | 1019 url, |
| 1020 referrer_charset, | 1020 referrer, |
| 1021 save_info, | 1021 referrer_charset, |
| 1022 g_browser_process->resource_dispatcher_host(), | 1022 save_info, |
| 1023 tab_contents->GetRenderProcessHost()->id(), | 1023 g_browser_process->resource_dispatcher_host(), |
| 1024 tab_contents->render_view_host()->routing_id(), | 1024 tab_contents->GetRenderProcessHost()->id(), |
| 1025 &tab_contents->profile()->GetResourceContext())); | 1025 tab_contents->render_view_host()->routing_id(), |
| 1026 &tab_contents->browser_context()->GetResourceContext())); |
| 1026 } | 1027 } |
| 1027 | 1028 |
| 1028 void DownloadManager::AddObserver(Observer* observer) { | 1029 void DownloadManager::AddObserver(Observer* observer) { |
| 1029 observers_.AddObserver(observer); | 1030 observers_.AddObserver(observer); |
| 1030 observer->ModelChanged(); | 1031 observer->ModelChanged(); |
| 1031 } | 1032 } |
| 1032 | 1033 |
| 1033 void DownloadManager::RemoveObserver(Observer* observer) { | 1034 void DownloadManager::RemoveObserver(Observer* observer) { |
| 1034 observers_.RemoveObserver(observer); | 1035 observers_.RemoveObserver(observer); |
| 1035 } | 1036 } |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1346 observed_download_manager_->RemoveObserver(this); | 1347 observed_download_manager_->RemoveObserver(this); |
| 1347 } | 1348 } |
| 1348 | 1349 |
| 1349 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() { | 1350 void DownloadManager::OtherDownloadManagerObserver::ModelChanged() { |
| 1350 observing_download_manager_->NotifyModelChanged(); | 1351 observing_download_manager_->NotifyModelChanged(); |
| 1351 } | 1352 } |
| 1352 | 1353 |
| 1353 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { | 1354 void DownloadManager::OtherDownloadManagerObserver::ManagerGoingDown() { |
| 1354 observed_download_manager_ = NULL; | 1355 observed_download_manager_ = NULL; |
| 1355 } | 1356 } |
| OLD | NEW |