| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 web_contents()->GetBrowserContext(); | 286 web_contents()->GetBrowserContext(); |
| 287 if (!browser_context) { | 287 if (!browser_context) { |
| 288 NOTREACHED(); | 288 NOTREACHED(); |
| 289 return false; | 289 return false; |
| 290 } | 290 } |
| 291 | 291 |
| 292 // The download manager keeps ownership but adds us as an observer. | 292 // The download manager keeps ownership but adds us as an observer. |
| 293 download_ = download_manager_->CreateSavePackageDownloadItem( | 293 download_ = download_manager_->CreateSavePackageDownloadItem( |
| 294 saved_main_file_path_, | 294 saved_main_file_path_, |
| 295 page_url_, | 295 page_url_, |
| 296 browser_context->IsOffTheRecord(), | |
| 297 ((save_type_ == content::SAVE_PAGE_TYPE_AS_MHTML) ? | 296 ((save_type_ == content::SAVE_PAGE_TYPE_AS_MHTML) ? |
| 298 "multipart/related" : "text/html"), | 297 "multipart/related" : "text/html"), |
| 299 this); | 298 this); |
| 300 if (!download_created_callback.is_null()) | 299 if (!download_created_callback.is_null()) |
| 301 download_created_callback.Run(download_); | 300 download_created_callback.Run(download_); |
| 302 | 301 |
| 303 // Check save type and process the save page job. | 302 // Check save type and process the save page job. |
| 304 if (save_type_ == content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML) { | 303 if (save_type_ == content::SAVE_PAGE_TYPE_AS_COMPLETE_HTML) { |
| 305 // Get directory | 304 // Get directory |
| 306 DCHECK(!saved_main_directory_path_.empty()); | 305 DCHECK(!saved_main_directory_path_.empty()); |
| (...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 } | 1368 } |
| 1370 } | 1369 } |
| 1371 | 1370 |
| 1372 void SavePackage::FinalizeDownloadEntry() { | 1371 void SavePackage::FinalizeDownloadEntry() { |
| 1373 DCHECK(download_); | 1372 DCHECK(download_); |
| 1374 DCHECK(download_manager_); | 1373 DCHECK(download_manager_); |
| 1375 | 1374 |
| 1376 download_manager_->SavePageDownloadFinished(download_); | 1375 download_manager_->SavePageDownloadFinished(download_); |
| 1377 StopObservation(); | 1376 StopObservation(); |
| 1378 } | 1377 } |
| OLD | NEW |