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

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

Issue 9580002: Add ResourceRequestInfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 13 matching lines...) Expand all
24 #include "content/public/browser/render_process_host.h" 24 #include "content/public/browser/render_process_host.h"
25 #include "content/public/browser/render_view_host.h" 25 #include "content/public/browser/render_view_host.h"
26 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
27 27
28 using content::BrowserThread; 28 using content::BrowserThread;
29 using content::DownloadItem; 29 using content::DownloadItem;
30 30
31 namespace { 31 namespace {
32 32
33 void BeginDownload(const GURL& url, 33 void BeginDownload(const GURL& url,
34 ResourceDispatcherHost* rdh,
35 content::ResourceContext* resource_context, 34 content::ResourceContext* resource_context,
36 int render_process_host_id, 35 int render_process_host_id,
37 int render_view_host_routing_id, 36 int render_view_host_routing_id,
38 const DownloadResourceHandler::OnStartedCallback& callback) { 37 const DownloadResourceHandler::OnStartedCallback& callback) {
39 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
40 39
40 ResourceDispatcherHost* rdh = ResourceDispatcherHost::Get();
41 scoped_ptr<net::URLRequest> request( 41 scoped_ptr<net::URLRequest> request(
42 new net::URLRequest(url, rdh)); 42 new net::URLRequest(url, rdh));
43 net::Error error = rdh->BeginDownload( 43 net::Error error = rdh->BeginDownload(
44 request.Pass(), 44 request.Pass(),
45 true, // prefer_cache 45 true, // prefer_cache
46 DownloadSaveInfo(), 46 DownloadSaveInfo(),
47 callback, 47 callback,
48 render_process_host_id, 48 render_process_host_id,
49 render_view_host_routing_id, 49 render_view_host_routing_id,
50 resource_context); 50 resource_context);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 state_ = kStateDownloading; 138 state_ = kStateDownloading;
139 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadStarted()); 139 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadStarted());
140 content::WebContents* web_contents = wrapper->web_contents(); 140 content::WebContents* web_contents = wrapper->web_contents();
141 DownloadService* download_service = 141 DownloadService* download_service =
142 DownloadServiceFactory::GetForProfile(wrapper->profile()); 142 DownloadServiceFactory::GetForProfile(wrapper->profile());
143 download_util::RecordDownloadSource( 143 download_util::RecordDownloadSource(
144 download_util::INITIATED_BY_PLUGIN_INSTALLER); 144 download_util::INITIATED_BY_PLUGIN_INSTALLER);
145 BrowserThread::PostTask( 145 BrowserThread::PostTask(
146 BrowserThread::IO, FROM_HERE, 146 BrowserThread::IO, FROM_HERE,
147 base::Bind(&BeginDownload, 147 base::Bind(&BeginDownload,
148 plugin_url_, ResourceDispatcherHost::Get(), 148 plugin_url_,
149 wrapper->profile()->GetResourceContext(), 149 wrapper->profile()->GetResourceContext(),
150 web_contents->GetRenderProcessHost()->GetID(), 150 web_contents->GetRenderProcessHost()->GetID(),
151 web_contents->GetRenderViewHost()->GetRoutingID(), 151 web_contents->GetRenderViewHost()->GetRoutingID(),
152 base::Bind(&PluginInstaller::DownloadStarted, 152 base::Bind(&PluginInstaller::DownloadStarted,
153 base::Unretained(this), 153 base::Unretained(this),
154 make_scoped_refptr( 154 make_scoped_refptr(
155 download_service->GetDownloadManager())))); 155 download_service->GetDownloadManager()))));
156 } 156 }
157 157
158 void PluginInstaller::DownloadStarted( 158 void PluginInstaller::DownloadStarted(
(...skipping 27 matching lines...) Expand all
186 DCHECK(state_ == kStateDownloading); 186 DCHECK(state_ == kStateDownloading);
187 state_ = kStateIdle; 187 state_ = kStateIdle;
188 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadError(msg)); 188 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadError(msg));
189 } 189 }
190 190
191 void PluginInstaller::DownloadCancelled() { 191 void PluginInstaller::DownloadCancelled() {
192 DCHECK(state_ == kStateDownloading); 192 DCHECK(state_ == kStateDownloading);
193 state_ = kStateIdle; 193 state_ = kStateIdle;
194 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadCancelled()); 194 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadCancelled());
195 } 195 }
OLDNEW
« no previous file with comments | « chrome/browser/external_tab_container_win.cc ('k') | chrome/browser/profiles/profile_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698