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

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

Issue 7112011: Change DownloadProcessHandle to be more of an encapsulated class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to LKGR. Created 9 years, 6 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
« no previous file with comments | « chrome/browser/download/download_item.h ('k') | chrome/browser/download/download_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/download_item.h" 5 #include "chrome/browser/download/download_item.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/i18n/case_conversion.h" 10 #include "base/i18n/case_conversion.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } 147 }
148 148
149 // Constructing for a regular download: 149 // Constructing for a regular download:
150 DownloadItem::DownloadItem(DownloadManager* download_manager, 150 DownloadItem::DownloadItem(DownloadManager* download_manager,
151 const DownloadCreateInfo& info, 151 const DownloadCreateInfo& info,
152 bool is_otr) 152 bool is_otr)
153 : state_info_(info.original_name, info.save_info.file_path, 153 : state_info_(info.original_name, info.save_info.file_path,
154 info.has_user_gesture, info.prompt_user_for_save_location, 154 info.has_user_gesture, info.prompt_user_for_save_location,
155 info.path_uniquifier, false, false, 155 info.path_uniquifier, false, false,
156 info.is_extension_install), 156 info.is_extension_install),
157 process_handle_(info.process_handle), 157 request_handle_(info.request_handle),
158 download_id_(info.download_id), 158 download_id_(info.download_id),
159 full_path_(info.path), 159 full_path_(info.path),
160 url_chain_(info.url_chain), 160 url_chain_(info.url_chain),
161 referrer_url_(info.referrer_url), 161 referrer_url_(info.referrer_url),
162 content_disposition_(info.content_disposition), 162 content_disposition_(info.content_disposition),
163 mime_type_(info.mime_type), 163 mime_type_(info.mime_type),
164 original_mime_type_(info.original_mime_type), 164 original_mime_type_(info.original_mime_type),
165 referrer_charset_(info.referrer_charset), 165 referrer_charset_(info.referrer_charset),
166 total_bytes_(info.total_bytes), 166 total_bytes_(info.total_bytes),
167 received_bytes_(0), 167 received_bytes_(0),
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 void DownloadItem::Rename(const FilePath& full_path) { 492 void DownloadItem::Rename(const FilePath& full_path) {
493 VLOG(20) << __FUNCTION__ << "()" 493 VLOG(20) << __FUNCTION__ << "()"
494 << " full_path = \"" << full_path.value() << "\"" 494 << " full_path = \"" << full_path.value() << "\""
495 << " " << DebugString(true); 495 << " " << DebugString(true);
496 DCHECK(!full_path.empty()); 496 DCHECK(!full_path.empty());
497 full_path_ = full_path; 497 full_path_ = full_path;
498 } 498 }
499 499
500 void DownloadItem::TogglePause() { 500 void DownloadItem::TogglePause() {
501 DCHECK(IsInProgress()); 501 DCHECK(IsInProgress());
502 download_manager_->PauseDownload(download_id_, !is_paused_); 502 if (is_paused_)
503 request_handle_.ResumeRequest();
504 else
505 request_handle_.PauseRequest();
503 is_paused_ = !is_paused_; 506 is_paused_ = !is_paused_;
504 UpdateObservers(); 507 UpdateObservers();
505 } 508 }
506 509
507 void DownloadItem::OnDownloadCompleting(DownloadFileManager* file_manager) { 510 void DownloadItem::OnDownloadCompleting(DownloadFileManager* file_manager) {
508 VLOG(20) << __FUNCTION__ << "()" 511 VLOG(20) << __FUNCTION__ << "()"
509 << " needs rename = " << NeedsRename() 512 << " needs rename = " << NeedsRename()
510 << " " << DebugString(true); 513 << " " << DebugString(true);
511 DCHECK_NE(DANGEROUS, safety_state()); 514 DCHECK_NE(DANGEROUS, safety_state());
512 DCHECK(file_manager); 515 DCHECK(file_manager);
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 state_info_.target_name.value().c_str(), 723 state_info_.target_name.value().c_str(),
721 full_path().value().c_str()); 724 full_path().value().c_str());
722 } else { 725 } else {
723 description += base::StringPrintf(" url = \"%s\"", url_list.c_str()); 726 description += base::StringPrintf(" url = \"%s\"", url_list.c_str());
724 } 727 }
725 728
726 description += " }"; 729 description += " }";
727 730
728 return description; 731 return description;
729 } 732 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_item.h ('k') | chrome/browser/download/download_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698