Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: chrome/browser/download/save_package.cc

Issue 7374008: Move download stuff from download helper back to TabContents. This is basically a revert of r8576... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 15 matching lines...) Expand all
26 #include "chrome/browser/download/download_util.h" 26 #include "chrome/browser/download/download_util.h"
27 #include "chrome/browser/download/save_file.h" 27 #include "chrome/browser/download/save_file.h"
28 #include "chrome/browser/download/save_file_manager.h" 28 #include "chrome/browser/download/save_file_manager.h"
29 #include "chrome/browser/download/save_item.h" 29 #include "chrome/browser/download/save_item.h"
30 #include "chrome/browser/net/url_fixer_upper.h" 30 #include "chrome/browser/net/url_fixer_upper.h"
31 #include "chrome/browser/platform_util.h" 31 #include "chrome/browser/platform_util.h"
32 #include "chrome/browser/prefs/pref_member.h" 32 #include "chrome/browser/prefs/pref_member.h"
33 #include "chrome/browser/prefs/pref_service.h" 33 #include "chrome/browser/prefs/pref_service.h"
34 #include "chrome/browser/profiles/profile.h" 34 #include "chrome/browser/profiles/profile.h"
35 #include "chrome/browser/tab_contents/tab_util.h" 35 #include "chrome/browser/tab_contents/tab_util.h"
36 #include "chrome/browser/ui/download/download_tab_helper.h"
37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 36 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
38 #include "chrome/common/chrome_notification_types.h" 37 #include "chrome/common/chrome_notification_types.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"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 tab_contents()->profile()->GetDownloadManager(); 318 tab_contents()->profile()->GetDownloadManager();
320 download_ = new DownloadItem(download_manager, 319 download_ = new DownloadItem(download_manager,
321 saved_main_file_path_, 320 saved_main_file_path_,
322 page_url_, 321 page_url_,
323 profile->IsOffTheRecord()); 322 profile->IsOffTheRecord());
324 323
325 // Transfer the ownership to the download manager. We need the DownloadItem 324 // Transfer the ownership to the download manager. We need the DownloadItem
326 // to be alive as long as the Profile is alive. 325 // to be alive as long as the Profile is alive.
327 download_manager->SavePageAsDownloadStarted(download_); 326 download_manager->SavePageAsDownloadStarted(download_);
328 327
329 wrapper_->download_tab_helper()->OnStartDownload(download_); 328 tab_contents()->OnStartDownload(download_);
330 329
331 // Check save type and process the save page job. 330 // Check save type and process the save page job.
332 if (save_type_ == SAVE_AS_COMPLETE_HTML) { 331 if (save_type_ == SAVE_AS_COMPLETE_HTML) {
333 // Get directory 332 // Get directory
334 DCHECK(!saved_main_directory_path_.empty()); 333 DCHECK(!saved_main_directory_path_.empty());
335 GetAllSavableResourceLinksForCurrentPage(); 334 GetAllSavableResourceLinksForCurrentPage();
336 } else { 335 } else {
337 wait_state_ = NET_FILES; 336 wait_state_ = NET_FILES;
338 SaveFileCreateInfo::SaveFileSource save_source = page_url_.SchemeIsFile() ? 337 SaveFileCreateInfo::SaveFileSource save_source = page_url_.SchemeIsFile() ?
339 SaveFileCreateInfo::SAVE_FILE_FROM_FILE : 338 SaveFileCreateInfo::SAVE_FILE_FROM_FILE :
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698