OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/save_package.h" | 5 #include "chrome/browser/download/save_package.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/i18n/file_util_icu.h" | 10 #include "base/i18n/file_util_icu.h" |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 // Initialize the request context and resource dispatcher. | 370 // Initialize the request context and resource dispatcher. |
371 Profile* profile = tab_contents_->profile(); | 371 Profile* profile = tab_contents_->profile(); |
372 if (!profile) { | 372 if (!profile) { |
373 NOTREACHED(); | 373 NOTREACHED(); |
374 return false; | 374 return false; |
375 } | 375 } |
376 | 376 |
377 request_context_getter_ = profile->GetRequestContext(); | 377 request_context_getter_ = profile->GetRequestContext(); |
378 | 378 |
379 // Create the fake DownloadItem and display the view. | 379 // Create the fake DownloadItem and display the view. |
380 download_ = new DownloadItem(1, saved_main_file_path_, 0, page_url_, GURL(), | 380 download_ = new DownloadItem(tab_contents_->profile()->GetDownloadManager(), |
381 "", "", FilePath(), Time::Now(), 0, -1, -1, false, false, | 381 saved_main_file_path_, page_url_, |
382 profile->IsOffTheRecord(), false, false); | 382 profile->IsOffTheRecord()); |
383 download_->set_manager(tab_contents_->profile()->GetDownloadManager()); | |
384 tab_contents_->OnStartDownload(download_); | 383 tab_contents_->OnStartDownload(download_); |
385 | 384 |
386 // Check save type and process the save page job. | 385 // Check save type and process the save page job. |
387 if (save_type_ == SAVE_AS_COMPLETE_HTML) { | 386 if (save_type_ == SAVE_AS_COMPLETE_HTML) { |
388 // Get directory | 387 // Get directory |
389 DCHECK(!saved_main_directory_path_.empty()); | 388 DCHECK(!saved_main_directory_path_.empty()); |
390 GetAllSavableResourceLinksForCurrentPage(); | 389 GetAllSavableResourceLinksForCurrentPage(); |
391 } else { | 390 } else { |
392 wait_state_ = NET_FILES; | 391 wait_state_ = NET_FILES; |
393 GURL u(page_url_); | 392 GURL u(page_url_); |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1377 int index, void* params) { | 1376 int index, void* params) { |
1378 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); | 1377 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); |
1379 ContinueSave(save_params, path, index); | 1378 ContinueSave(save_params, path, index); |
1380 delete save_params; | 1379 delete save_params; |
1381 } | 1380 } |
1382 | 1381 |
1383 void SavePackage::FileSelectionCanceled(void* params) { | 1382 void SavePackage::FileSelectionCanceled(void* params) { |
1384 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); | 1383 SavePackageParam* save_params = reinterpret_cast<SavePackageParam*>(params); |
1385 delete save_params; | 1384 delete save_params; |
1386 } | 1385 } |
OLD | NEW |