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

Unified Diff: content/browser/download/download_item.cc

Issue 8399001: Use a DownloadRequestHandle pointer in construction to allow mocking for tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed compile error. Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/download/download_item.cc
diff --git a/content/browser/download/download_item.cc b/content/browser/download/download_item.cc
index 84387b667353a3727d369273445e656fed360f2b..c81fa401c7041133e208c5ab0d5ab9bcfda4dcca 100644
--- a/content/browser/download/download_item.cc
+++ b/content/browser/download/download_item.cc
@@ -154,7 +154,7 @@ DownloadItem::DownloadItem(DownloadManager* download_manager,
// Constructing for a regular download:
DownloadItem::DownloadItem(DownloadManager* download_manager,
const DownloadCreateInfo& info,
- const DownloadRequestHandle& request_handle,
+ DownloadRequestHandleInterface* request_handle,
bool is_otr)
: state_info_(info.original_name, info.save_info.file_path,
info.has_user_gesture, info.transition_type,
@@ -576,9 +576,9 @@ void DownloadItem::TogglePause() {
DCHECK(IsInProgress());
if (is_paused_)
- request_handle_.ResumeRequest();
+ request_handle_->ResumeRequest();
else
- request_handle_.PauseRequest();
+ request_handle_->PauseRequest();
is_paused_ = !is_paused_;
UpdateObservers();
}
@@ -642,7 +642,7 @@ bool DownloadItem::MatchesQuery(const string16& query) const {
// L"/\x4f60\x597d\x4f60\x597d",
// "/%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD"
std::string languages;
- TabContents* tab = request_handle_.GetTabContents();
+ TabContents* tab = request_handle_->GetTabContents();
if (tab)
languages = content::GetContentClient()->browser()->GetAcceptLangs(tab);
string16 url_formatted(net::FormatUrl(GetURL(), languages));
@@ -702,6 +702,12 @@ DownloadPersistentStoreInfo DownloadItem::GetPersistentStoreInfo() const {
opened());
}
+TabContents* DownloadItem::GetTabContents() const {
+ if (request_handle_.get())
cbentzel 2011/10/27 17:20:39 Why is this needed? DownloadItem::MatchesQuery doe
Randy Smith (Not in Mondays) 2011/10/27 18:21:22 See DownloadManager::RestartDownload. I ran into
cbentzel 2011/10/27 18:45:34 I have no problem with the wrapper - just was more
+ return request_handle_->GetTabContents();
+ return NULL;
+}
+
FilePath DownloadItem::GetTargetFilePath() const {
return full_path_.DirName().Append(state_info_.target_name);
}
@@ -722,7 +728,7 @@ FilePath DownloadItem::GetUserVerifiedFilePath() const {
void DownloadItem::OffThreadCancel(DownloadFileManager* file_manager) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- request_handle_.CancelRequest();
+ request_handle_->CancelRequest();
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698