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