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/save_package.h" | 5 #include "chrome/browser/download/save_package.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "chrome/browser/download/download_util.h" | 27 #include "chrome/browser/download/download_util.h" |
28 #include "chrome/browser/download/save_file.h" | 28 #include "chrome/browser/download/save_file.h" |
29 #include "chrome/browser/download/save_file_manager.h" | 29 #include "chrome/browser/download/save_file_manager.h" |
30 #include "chrome/browser/download/save_item.h" | 30 #include "chrome/browser/download/save_item.h" |
31 #include "chrome/browser/net/url_fixer_upper.h" | 31 #include "chrome/browser/net/url_fixer_upper.h" |
32 #include "chrome/browser/platform_util.h" | 32 #include "chrome/browser/platform_util.h" |
33 #include "chrome/browser/prefs/pref_member.h" | 33 #include "chrome/browser/prefs/pref_member.h" |
34 #include "chrome/browser/prefs/pref_service.h" | 34 #include "chrome/browser/prefs/pref_service.h" |
35 #include "chrome/browser/profiles/profile.h" | 35 #include "chrome/browser/profiles/profile.h" |
36 #include "chrome/browser/tab_contents/tab_util.h" | 36 #include "chrome/browser/tab_contents/tab_util.h" |
| 37 #include "chrome/browser/ui/download/download_tab_helper.h" |
37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 38 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
38 #include "chrome/common/chrome_paths.h" | 39 #include "chrome/common/chrome_paths.h" |
39 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
40 #include "chrome/common/render_messages.h" | 41 #include "chrome/common/render_messages.h" |
41 #include "chrome/common/url_constants.h" | 42 #include "chrome/common/url_constants.h" |
42 #include "content/browser/browser_thread.h" | 43 #include "content/browser/browser_thread.h" |
43 #include "content/browser/renderer_host/render_process_host.h" | 44 #include "content/browser/renderer_host/render_process_host.h" |
44 #include "content/browser/renderer_host/render_view_host.h" | 45 #include "content/browser/renderer_host/render_view_host.h" |
45 #include "content/browser/renderer_host/render_view_host_delegate.h" | 46 #include "content/browser/renderer_host/render_view_host_delegate.h" |
46 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 47 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 tab_contents()->profile()->GetDownloadManager(); | 320 tab_contents()->profile()->GetDownloadManager(); |
320 download_ = new DownloadItem(download_manager, | 321 download_ = new DownloadItem(download_manager, |
321 saved_main_file_path_, | 322 saved_main_file_path_, |
322 page_url_, | 323 page_url_, |
323 profile->IsOffTheRecord()); | 324 profile->IsOffTheRecord()); |
324 | 325 |
325 // Transfer the ownership to the download manager. We need the DownloadItem | 326 // Transfer the ownership to the download manager. We need the DownloadItem |
326 // to be alive as long as the Profile is alive. | 327 // to be alive as long as the Profile is alive. |
327 download_manager->SavePageAsDownloadStarted(download_); | 328 download_manager->SavePageAsDownloadStarted(download_); |
328 | 329 |
329 tab_contents()->OnStartDownload(download_); | 330 wrapper_->download_tab_helper()->OnStartDownload(download_); |
330 | 331 |
331 // Check save type and process the save page job. | 332 // Check save type and process the save page job. |
332 if (save_type_ == SAVE_AS_COMPLETE_HTML) { | 333 if (save_type_ == SAVE_AS_COMPLETE_HTML) { |
333 // Get directory | 334 // Get directory |
334 DCHECK(!saved_main_directory_path_.empty()); | 335 DCHECK(!saved_main_directory_path_.empty()); |
335 GetAllSavableResourceLinksForCurrentPage(); | 336 GetAllSavableResourceLinksForCurrentPage(); |
336 } else { | 337 } else { |
337 wait_state_ = NET_FILES; | 338 wait_state_ = NET_FILES; |
338 SaveFileCreateInfo::SaveFileSource save_source = page_url_.SchemeIsFile() ? | 339 SaveFileCreateInfo::SaveFileSource save_source = page_url_.SchemeIsFile() ? |
339 SaveFileCreateInfo::SAVE_FILE_FROM_FILE : | 340 SaveFileCreateInfo::SAVE_FILE_FROM_FILE : |
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 } | 1467 } |
1467 | 1468 |
1468 // SelectFileDialog::Listener interface. | 1469 // SelectFileDialog::Listener interface. |
1469 void SavePackage::FileSelected(const FilePath& path, | 1470 void SavePackage::FileSelected(const FilePath& path, |
1470 int index, void* params) { | 1471 int index, void* params) { |
1471 ContinueSave(path, index); | 1472 ContinueSave(path, index); |
1472 } | 1473 } |
1473 | 1474 |
1474 void SavePackage::FileSelectionCanceled(void* params) { | 1475 void SavePackage::FileSelectionCanceled(void* params) { |
1475 } | 1476 } |
OLD | NEW |