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

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());
229 dlm->GetActiveDownloadItem(download_id.local());
230 download_item->SetOpenWhenComplete(true); 229 download_item->SetOpenWhenComplete(true);
231 download_item->AddObserver(this); 230 download_item->AddObserver(this);
232 } 231 }
233 232
234 void PluginInstaller::OpenDownloadURL(content::WebContents* web_contents) { 233 void PluginInstaller::OpenDownloadURL(content::WebContents* web_contents) {
235 DCHECK_EQ(INSTALLER_STATE_IDLE, state_); 234 DCHECK_EQ(INSTALLER_STATE_IDLE, state_);
236 DCHECK(url_for_display_); 235 DCHECK(url_for_display_);
237 web_contents->OpenURL(content::OpenURLParams( 236 web_contents->OpenURL(content::OpenURLParams(
238 plugin_url_, 237 plugin_url_,
239 content::Referrer(web_contents->GetURL(), 238 content::Referrer(web_contents->GetURL(),
(...skipping 10 matching lines...) Expand all
250 249
251 void PluginInstaller::DownloadCancelled() { 250 void PluginInstaller::DownloadCancelled() {
252 DCHECK_EQ(INSTALLER_STATE_DOWNLOADING, state_); 251 DCHECK_EQ(INSTALLER_STATE_DOWNLOADING, state_);
253 state_ = INSTALLER_STATE_IDLE; 252 state_ = INSTALLER_STATE_IDLE;
254 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadCancelled()); 253 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadCancelled());
255 } 254 }
256 255
257 bool PluginInstaller::MatchesPlugin(const webkit::WebPluginInfo& plugin) { 256 bool PluginInstaller::MatchesPlugin(const webkit::WebPluginInfo& plugin) {
258 return plugin.name.find(group_name_matcher_) != string16::npos; 257 return plugin.name.find(group_name_matcher_) != string16::npos;
259 } 258 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698