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

Side by Side Diff: chrome/browser/plugin_installer.cc

Issue 10912183: Remove DownloadManager::GetDownloadItem in favor of GetDownload() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/plugin_installer.h" 5 #include "chrome/browser/plugin_installer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/process.h" 10 #include "base/process.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 void PluginInstaller::DownloadStarted( 218 void PluginInstaller::DownloadStarted(
219 scoped_refptr<content::DownloadManager> dlm, 219 scoped_refptr<content::DownloadManager> dlm,
220 content::DownloadId download_id, 220 content::DownloadId download_id,
221 net::Error error) { 221 net::Error error) {
222 if (error != net::OK) { 222 if (error != net::OK) {
223 std::string msg = 223 std::string msg =
224 base::StringPrintf("Error %d: %s", error, net::ErrorToString(error)); 224 base::StringPrintf("Error %d: %s", error, net::ErrorToString(error));
225 DownloadError(msg); 225 DownloadError(msg);
226 return; 226 return;
227 } 227 }
228 DownloadItem* download_item = 228 DownloadItem* download_item = dlm->GetDownload(download_id.local());
Randy Smith (Not in Mondays) 2012/09/13 18:52:44 I'd be inclined to put a DCHECK after this that we
benjhayden 2012/09/13 20:19:36 TODone, see response to below comment.
229 dlm->GetActiveDownloadItem(download_id.local()); 229 if (!download_item) {
230 DownloadError("Download not found");
231 return;
Randy Smith (Not in Mondays) 2012/09/13 18:52:44 Why the addition of the error return? GetDownload
benjhayden 2012/09/13 20:19:36 We saw in WebstoreInstaller where the DownloadStar
232 }
230 download_item->SetOpenWhenComplete(true); 233 download_item->SetOpenWhenComplete(true);
231 download_item->AddObserver(this); 234 download_item->AddObserver(this);
232 } 235 }
233 236
234 void PluginInstaller::OpenDownloadURL(content::WebContents* web_contents) { 237 void PluginInstaller::OpenDownloadURL(content::WebContents* web_contents) {
235 DCHECK_EQ(INSTALLER_STATE_IDLE, state_); 238 DCHECK_EQ(INSTALLER_STATE_IDLE, state_);
236 DCHECK(url_for_display_); 239 DCHECK(url_for_display_);
237 web_contents->OpenURL(content::OpenURLParams( 240 web_contents->OpenURL(content::OpenURLParams(
238 plugin_url_, 241 plugin_url_,
239 content::Referrer(web_contents->GetURL(), 242 content::Referrer(web_contents->GetURL(),
(...skipping 10 matching lines...) Expand all
250 253
251 void PluginInstaller::DownloadCancelled() { 254 void PluginInstaller::DownloadCancelled() {
252 DCHECK_EQ(INSTALLER_STATE_DOWNLOADING, state_); 255 DCHECK_EQ(INSTALLER_STATE_DOWNLOADING, state_);
253 state_ = INSTALLER_STATE_IDLE; 256 state_ = INSTALLER_STATE_IDLE;
254 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadCancelled()); 257 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadCancelled());
255 } 258 }
256 259
257 bool PluginInstaller::MatchesPlugin(const webkit::WebPluginInfo& plugin) { 260 bool PluginInstaller::MatchesPlugin(const webkit::WebPluginInfo& plugin) {
258 return plugin.name.find(group_name_matcher_) != string16::npos; 261 return plugin.name.find(group_name_matcher_) != string16::npos;
259 } 262 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698