| 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 "content/browser/download/save_package.h" | 5 #include "content/browser/download/save_package.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 | 1147 |
| 1148 void SavePackage::GetSaveInfo() { | 1148 void SavePackage::GetSaveInfo() { |
| 1149 // Can't use tab_contents_ in the file thread, so get the data that we need | 1149 // Can't use tab_contents_ in the file thread, so get the data that we need |
| 1150 // before calling to it. | 1150 // before calling to it. |
| 1151 FilePath website_save_dir, download_save_dir; | 1151 FilePath website_save_dir, download_save_dir; |
| 1152 DCHECK(download_manager_); | 1152 DCHECK(download_manager_); |
| 1153 download_manager_->delegate()->GetSaveDir( | 1153 download_manager_->delegate()->GetSaveDir( |
| 1154 tab_contents(), &website_save_dir, &download_save_dir); | 1154 tab_contents(), &website_save_dir, &download_save_dir); |
| 1155 std::string mime_type = tab_contents()->contents_mime_type(); | 1155 std::string mime_type = tab_contents()->contents_mime_type(); |
| 1156 std::string accept_languages = | 1156 std::string accept_languages = |
| 1157 content::GetContentClient()->browser()->GetAcceptLangs(tab_contents()); | 1157 content::GetContentClient()->browser()->GetAcceptLangs( |
| 1158 tab_contents()->browser_context()); |
| 1158 | 1159 |
| 1159 BrowserThread::PostTask( | 1160 BrowserThread::PostTask( |
| 1160 BrowserThread::FILE, FROM_HERE, | 1161 BrowserThread::FILE, FROM_HERE, |
| 1161 base::Bind(&SavePackage::CreateDirectoryOnFileThread, this, | 1162 base::Bind(&SavePackage::CreateDirectoryOnFileThread, this, |
| 1162 website_save_dir, download_save_dir, mime_type, accept_languages)); | 1163 website_save_dir, download_save_dir, mime_type, accept_languages)); |
| 1163 } | 1164 } |
| 1164 | 1165 |
| 1165 void SavePackage::CreateDirectoryOnFileThread( | 1166 void SavePackage::CreateDirectoryOnFileThread( |
| 1166 const FilePath& website_save_dir, | 1167 const FilePath& website_save_dir, |
| 1167 const FilePath& download_save_dir, | 1168 const FilePath& download_save_dir, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 StopObservation(); | 1281 StopObservation(); |
| 1281 } | 1282 } |
| 1282 | 1283 |
| 1283 void SavePackage::FinalizeDownloadEntry() { | 1284 void SavePackage::FinalizeDownloadEntry() { |
| 1284 DCHECK(download_); | 1285 DCHECK(download_); |
| 1285 DCHECK(download_manager_); | 1286 DCHECK(download_manager_); |
| 1286 | 1287 |
| 1287 download_manager_->SavePageDownloadFinished(download_); | 1288 download_manager_->SavePageDownloadFinished(download_); |
| 1288 StopObservation(); | 1289 StopObservation(); |
| 1289 } | 1290 } |
| OLD | NEW |