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

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: Merge to TOT. 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
« no previous file with comments | « content/browser/download/download_item.h ('k') | content/browser/download/download_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_item.cc
diff --git a/content/browser/download/download_item.cc b/content/browser/download/download_item.cc
index 0913569c471811ff89a5d92c50d3cb9b2132f8cf..8c2afc8f4f06b105ffd6200b43370bc321da489b 100644
--- a/content/browser/download/download_item.cc
+++ b/content/browser/download/download_item.cc
@@ -157,7 +157,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,
@@ -575,9 +575,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())
+ 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,
base::Bind(&DownloadFileManager::CancelDownload,
« no previous file with comments | « content/browser/download/download_item.h ('k') | content/browser/download/download_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698