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

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

Issue 51953002: [Net] Add a priority parameter to URLRequest's constructor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 1 month 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/plugins/plugin_installer.h" 5 #include "chrome/browser/plugins/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/process/process.h" 9 #include "base/process/process.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "chrome/browser/download/download_service.h" 11 #include "chrome/browser/download/download_service.h"
12 #include "chrome/browser/download/download_service_factory.h" 12 #include "chrome/browser/download/download_service_factory.h"
13 #include "chrome/browser/download/download_stats.h" 13 #include "chrome/browser/download/download_stats.h"
14 #include "chrome/browser/platform_util.h" 14 #include "chrome/browser/platform_util.h"
15 #include "chrome/browser/plugins/plugin_installer_observer.h" 15 #include "chrome/browser/plugins/plugin_installer_observer.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "content/public/browser/browser_context.h" 17 #include "content/public/browser/browser_context.h"
18 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/download_item.h" 19 #include "content/public/browser/download_item.h"
20 #include "content/public/browser/download_save_info.h" 20 #include "content/public/browser/download_save_info.h"
21 #include "content/public/browser/render_process_host.h" 21 #include "content/public/browser/render_process_host.h"
22 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/render_view_host.h"
23 #include "content/public/browser/resource_context.h" 23 #include "content/public/browser/resource_context.h"
24 #include "content/public/browser/resource_dispatcher_host.h" 24 #include "content/public/browser/resource_dispatcher_host.h"
25 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
26 #include "content/public/common/referrer.h" 26 #include "content/public/common/referrer.h"
27 #include "net/base/request_priority.h"
27 #include "net/url_request/url_request.h" 28 #include "net/url_request/url_request.h"
28 #include "net/url_request/url_request_context.h" 29 #include "net/url_request/url_request_context.h"
29 30
30 using content::BrowserContext; 31 using content::BrowserContext;
31 using content::BrowserThread; 32 using content::BrowserThread;
32 using content::DownloadItem; 33 using content::DownloadItem;
33 using content::ResourceDispatcherHost; 34 using content::ResourceDispatcherHost;
34 35
35 namespace { 36 namespace {
36 37
37 void BeginDownload( 38 void BeginDownload(
38 const GURL& url, 39 const GURL& url,
39 content::ResourceContext* resource_context, 40 content::ResourceContext* resource_context,
40 int render_process_host_id, 41 int render_process_host_id,
41 int render_view_host_routing_id, 42 int render_view_host_routing_id,
42 const ResourceDispatcherHost::DownloadStartedCallback& callback) { 43 const ResourceDispatcherHost::DownloadStartedCallback& callback) {
43 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 44 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
44 45
45 ResourceDispatcherHost* rdh = ResourceDispatcherHost::Get(); 46 ResourceDispatcherHost* rdh = ResourceDispatcherHost::Get();
46 scoped_ptr<net::URLRequest> request( 47 scoped_ptr<net::URLRequest> request(
47 resource_context->GetRequestContext()->CreateRequest(url, NULL)); 48 resource_context->GetRequestContext()->CreateRequest(
49 url, net::DEFAULT_PRIORITY, NULL));
48 net::Error error = rdh->BeginDownload( 50 net::Error error = rdh->BeginDownload(
49 request.Pass(), 51 request.Pass(),
50 content::Referrer(), 52 content::Referrer(),
51 false, // is_content_initiated 53 false, // is_content_initiated
52 resource_context, 54 resource_context,
53 render_process_host_id, 55 render_process_host_id,
54 render_view_host_routing_id, 56 render_view_host_routing_id,
55 true, // prefer_cache 57 true, // prefer_cache
56 scoped_ptr<content::DownloadSaveInfo>(new content::DownloadSaveInfo()), 58 scoped_ptr<content::DownloadSaveInfo>(new content::DownloadSaveInfo()),
57 content::DownloadItem::kInvalidId, 59 content::DownloadItem::kInvalidId,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 DCHECK_EQ(INSTALLER_STATE_DOWNLOADING, state_); 182 DCHECK_EQ(INSTALLER_STATE_DOWNLOADING, state_);
181 state_ = INSTALLER_STATE_IDLE; 183 state_ = INSTALLER_STATE_IDLE;
182 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadError(msg)); 184 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadError(msg));
183 } 185 }
184 186
185 void PluginInstaller::DownloadCancelled() { 187 void PluginInstaller::DownloadCancelled() {
186 DCHECK_EQ(INSTALLER_STATE_DOWNLOADING, state_); 188 DCHECK_EQ(INSTALLER_STATE_DOWNLOADING, state_);
187 state_ = INSTALLER_STATE_IDLE; 189 state_ = INSTALLER_STATE_IDLE;
188 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadCancelled()); 190 FOR_EACH_OBSERVER(PluginInstallerObserver, observers_, DownloadCancelled());
189 } 191 }
OLDNEW
« no previous file with comments | « chrome/browser/net/http_pipelining_compatibility_client.cc ('k') | chrome/browser/policy/url_blacklist_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698