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

Unified Diff: chrome/browser/extensions/webstore_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/extensions/webstore_installer.h ('k') | chrome/browser/plugins/plugin_installer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/webstore_installer.cc
diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc
index 8b80979f052812f50953ee08585abf267ec46be0..82522be7851ad3f988e8366b28a4df6c44f68e56 100644
--- a/chrome/browser/extensions/webstore_installer.cc
+++ b/chrome/browser/extensions/webstore_installer.cc
@@ -45,7 +45,6 @@
using content::BrowserContext;
using content::BrowserThread;
-using content::DownloadId;
using content::DownloadItem;
using content::DownloadManager;
using content::NavigationController;
@@ -279,28 +278,21 @@ WebstoreInstaller::~WebstoreInstaller() {
}
}
-void WebstoreInstaller::OnDownloadStarted(DownloadId id, net::Error error) {
- if (error != net::OK) {
+void WebstoreInstaller::OnDownloadStarted(
+ DownloadItem* item, net::Error error) {
+ if (!item) {
+ DCHECK_NE(net::OK, error);
ReportFailure(net::ErrorToString(error), FAILURE_REASON_OTHER);
return;
}
- CHECK(id.IsValid());
-
- DownloadManager* download_manager =
- BrowserContext::GetDownloadManager(profile_);
- if (!download_manager)
- return;
- download_item_ = download_manager->GetDownload(id.local());
- // TODO(benjhayden): DCHECK(item && item->IsInProgress()) after investigating
- // the relationship between net::OK and invalid id.
- if (download_item_) {
- download_item_->AddObserver(this);
- if (approval_.get())
- download_item_->SetUserData(kApprovalKey, approval_.release());
- if (delegate_)
- delegate_->OnExtensionDownloadStarted(id_, download_item_);
- }
+ DCHECK_EQ(net::OK, error);
+ download_item_ = item;
+ download_item_->AddObserver(this);
+ if (approval_.get())
+ download_item_->SetUserData(kApprovalKey, approval_.release());
+ if (delegate_)
+ delegate_->OnExtensionDownloadStarted(id_, download_item_);
}
void WebstoreInstaller::OnDownloadUpdated(DownloadItem* download) {
« no previous file with comments | « chrome/browser/extensions/webstore_installer.h ('k') | chrome/browser/plugins/plugin_installer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698