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

Unified Diff: chrome/browser/plugins/plugin_installer.cc

Issue 11068027: OnDownloadStarted takes DownloadItem* instead of DownloadId (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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: chrome/browser/plugins/plugin_installer.cc
diff --git a/chrome/browser/plugins/plugin_installer.cc b/chrome/browser/plugins/plugin_installer.cc
index 678addd6dba53ff6e761191cc90006961d6002e9..3ffbd51c0778749840a04fd6a07814d8b057692c 100644
--- a/chrome/browser/plugins/plugin_installer.cc
+++ b/chrome/browser/plugins/plugin_installer.cc
@@ -60,7 +60,7 @@ void BeginDownload(
if (error != net::OK) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- base::Bind(callback, content::DownloadId::Invalid(), error));
+ base::Bind(callback, static_cast<DownloadItem*>(NULL), error));
}
}
@@ -155,23 +155,18 @@ void PluginInstaller::StartInstalling(bool url_for_display,
void PluginInstaller::DownloadStarted(
scoped_refptr<content::DownloadManager> dlm,
- content::DownloadId download_id,
+ content::DownloadItem* item,
net::Error error) {
- if (error != net::OK) {
+ if (!item) {
+ DCHECK_NE(net::OK, error);
std::string msg =
base::StringPrintf("Error %d: %s", error, net::ErrorToString(error));
DownloadError(msg);
return;
}
- DownloadItem* download_item = dlm->GetDownload(download_id.local());
- // TODO(benjhayden): DCHECK(item && item->IsInProgress()) after figuring out
- // why DownloadStarted may get net:OK but an invalid id.
- if (!download_item) {
- DownloadError("Download not found");
- return;
- }
- download_item->SetOpenWhenComplete(true);
- download_item->AddObserver(this);
+ DCHECK_EQ(net::OK, error);
+ item->SetOpenWhenComplete(true);
+ item->AddObserver(this);
}
void PluginInstaller::OpenDownloadURL(bool url_for_display,

Powered by Google App Engine
This is Rietveld 408576698