| 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/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 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1148 return extensions[i].suggested_extension; | 1148 return extensions[i].suggested_extension; |
| 1149 } | 1149 } |
| 1150 return FILE_PATH_LITERAL(""); | 1150 return FILE_PATH_LITERAL(""); |
| 1151 } | 1151 } |
| 1152 | 1152 |
| 1153 TabContents* SavePackage::tab_contents() const { | 1153 TabContents* SavePackage::tab_contents() const { |
| 1154 return | 1154 return |
| 1155 static_cast<TabContents*>(content::WebContentsObserver::web_contents()); | 1155 static_cast<TabContents*>(content::WebContentsObserver::web_contents()); |
| 1156 } | 1156 } |
| 1157 | 1157 |
| 1158 WebContents* SavePackage::web_contents() const { |
| 1159 return tab_contents(); |
| 1160 } |
| 1161 |
| 1158 void SavePackage::GetSaveInfo() { | 1162 void SavePackage::GetSaveInfo() { |
| 1159 // Can't use tab_contents_ in the file thread, so get the data that we need | 1163 // Can't use tab_contents_ in the file thread, so get the data that we need |
| 1160 // before calling to it. | 1164 // before calling to it. |
| 1161 FilePath website_save_dir, download_save_dir; | 1165 FilePath website_save_dir, download_save_dir; |
| 1162 DCHECK(download_manager_); | 1166 DCHECK(download_manager_); |
| 1163 download_manager_->delegate()->GetSaveDir( | 1167 download_manager_->delegate()->GetSaveDir( |
| 1164 tab_contents(), &website_save_dir, &download_save_dir); | 1168 tab_contents(), &website_save_dir, &download_save_dir); |
| 1165 std::string mime_type = web_contents()->GetContentsMimeType(); | 1169 std::string mime_type = web_contents()->GetContentsMimeType(); |
| 1166 std::string accept_languages = | 1170 std::string accept_languages = |
| 1167 content::GetContentClient()->browser()->GetAcceptLangs( | 1171 content::GetContentClient()->browser()->GetAcceptLangs( |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 StopObservation(); | 1297 StopObservation(); |
| 1294 } | 1298 } |
| 1295 | 1299 |
| 1296 void SavePackage::FinalizeDownloadEntry() { | 1300 void SavePackage::FinalizeDownloadEntry() { |
| 1297 DCHECK(download_); | 1301 DCHECK(download_); |
| 1298 DCHECK(download_manager_); | 1302 DCHECK(download_manager_); |
| 1299 | 1303 |
| 1300 download_manager_->SavePageDownloadFinished(download_); | 1304 download_manager_->SavePageDownloadFinished(download_); |
| 1301 StopObservation(); | 1305 StopObservation(); |
| 1302 } | 1306 } |
| OLD | NEW |