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

Unified Diff: chrome/browser/download/chrome_download_manager_delegate.cc

Issue 8503018: Split DownloadItem into an ABC, an Impl, and a Mock. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: CamelCase Created 9 years, 1 month 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: chrome/browser/download/chrome_download_manager_delegate.cc
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc
index b7b4af6fdca4bb335febbcf51ce79690289d6a27..7d7a443f27a021864757350ee13a6c0cf38ae14a 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -52,11 +52,11 @@ ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() {
bool ChromeDownloadManagerDelegate::IsExtensionDownload(
const DownloadItem* item) {
- if (item->prompt_user_for_save_location())
+ if (item->PromptUserForSaveLocation())
return false;
- return (item->mime_type() == Extension::kMimeType) ||
- UserScript::IsURLUserScript(item->GetURL(), item->mime_type());
+ return (item->GetMimeType() == Extension::kMimeType) ||
+ UserScript::IsURLUserScript(item->GetURL(), item->GetMimeType());
}
void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) {
@@ -89,7 +89,7 @@ bool ChromeDownloadManagerDelegate::ShouldStartDownload(int32 download_id) {
// Create a client to verify download URL with safebrowsing.
// It deletes itself after the callback.
scoped_refptr<DownloadSBClient> sb_client = new DownloadSBClient(
- download_id, download->url_chain(), download->referrer_url(),
+ download_id, download->GetUrlChain(), download->GetReferrerUrl(),
profile_->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled));
sb_client->CheckDownloadUrl(
base::Bind(&ChromeDownloadManagerDelegate::CheckDownloadUrlDone,
@@ -121,7 +121,7 @@ bool ChromeDownloadManagerDelegate::OverrideIntermediatePath(
// The download is a safe download. We need to rename it to its intermediate
// '.crdownload' path. The final name after user confirmation will be set
// from DownloadItem::OnDownloadCompleting.
- *intermediate_path = download_util::GetCrDownloadPath(item->full_path());
+ *intermediate_path = download_util::GetCrDownloadPath(item->GetFullPath());
return true;
}
@@ -163,7 +163,7 @@ bool ChromeDownloadManagerDelegate::ShouldOpenDownload(DownloadItem* item) {
DownloadProtectionService::DownloadInfo::FromDownloadItem(*item),
base::Bind(
&ChromeDownloadManagerDelegate::CheckClientDownloadDone,
- this, item->id()));
+ this, item->GetId()));
// For now, we won't delay the download for this.
}
#else
@@ -183,7 +183,7 @@ bool ChromeDownloadManagerDelegate::ShouldOpenDownload(DownloadItem* item) {
chrome::NOTIFICATION_CRX_INSTALLER_DONE,
content::Source<CrxInstaller>(crx_installer.get()));
- crx_installers_[crx_installer.get()] = item->id();
+ crx_installers_[crx_installer.get()] = item->GetId();
// The status text and percent complete indicator will change now
// that we are installing a CRX. Update observers so that they pick
// up the change.
@@ -205,17 +205,17 @@ void ChromeDownloadManagerDelegate::OnResponseCompleted(DownloadItem* item) {
// When hash is not available, it means either it is not calculated
// or there is error while it is calculated. We will skip the download hash
// check in that case.
- if (item->hash().empty())
+ if (item->GetHash().empty())
return;
scoped_refptr<DownloadSBClient> sb_client =
- new DownloadSBClient(item->id(),
- item->url_chain(),
- item->referrer_url(),
+ new DownloadSBClient(item->GetId(),
+ item->GetUrlChain(),
+ item->GetReferrerUrl(),
profile_->GetPrefs()->GetBoolean(
prefs::kSafeBrowsingEnabled));
sb_client->CheckDownloadHash(
- item->hash(),
+ item->GetHash(),
base::Bind(&ChromeDownloadManagerDelegate::CheckDownloadHashDone,
base::Unretained(this)));
#endif
@@ -318,7 +318,7 @@ void ChromeDownloadManagerDelegate::CheckDownloadUrlDone(
download->MarkUrlDangerous();
download_history_->CheckVisitedReferrerBefore(
- download_id, download->referrer_url(),
+ download_id, download->GetReferrerUrl(),
base::Bind(&ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone,
base::Unretained(this)));
}
@@ -355,7 +355,7 @@ void ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone(
// Check whether this download is for an extension install or not.
// Allow extensions to be explicitly saved.
- DownloadStateInfo state = download->state_info();
+ DownloadStateInfo state = download->GetStateInfo();
if (state.force_file_name.empty()) {
FilePath generated_name;
@@ -406,7 +406,7 @@ void ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone(
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
base::Bind(&ChromeDownloadManagerDelegate::CheckIfSuggestedPathExists,
- this, download->id(), state,
+ this, download->GetId(), state,
download_prefs_->download_path()));
}
@@ -524,7 +524,7 @@ bool ChromeDownloadManagerDelegate::IsDangerousFile(
if (IsExtensionDownload(&download)) {
ExtensionService* service = profile_->GetExtensionService();
if (!service || !service->IsDownloadFromGallery(download.GetURL(),
- download.referrer_url()))
+ download.GetReferrerUrl()))
return true;
}

Powered by Google App Engine
This is Rietveld 408576698