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

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: @r160830 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
« no previous file with comments | « chrome/browser/plugins/plugin_installer.h ('k') | chrome/browser/ui/intents/web_intent_picker_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/plugins/plugin_installer.cc
diff --git a/chrome/browser/plugins/plugin_installer.cc b/chrome/browser/plugins/plugin_installer.cc
index 2b2ea7e87546380ba9ee5c5d4cecc13e5829b940..6f4e32f5e62b5d39a36269b2fdf4da18552c98a2 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));
}
}
@@ -153,23 +153,18 @@ void PluginInstaller::StartInstalling(const GURL& plugin_url,
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(const GURL& plugin_url,
« no previous file with comments | « chrome/browser/plugins/plugin_installer.h ('k') | chrome/browser/ui/intents/web_intent_picker_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698