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

Side by Side Diff: content/public/browser/download_url_parameters.cc

Issue 1924473003: [Downloads] Use the initiating StoragePartition for resumption. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ordering of site_instance_url/SiteInstanceURL fields, and add history test for WebViewTest. Created 4 years, 7 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
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 "content/public/browser/download_url_parameters.h" 5 #include "content/public/browser/download_url_parameters.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "content/public/browser/browser_context.h" 8 #include "content/public/browser/browser_context.h"
9 #include "content/public/browser/download_save_info.h" 9 #include "content/public/browser/download_save_info.h"
10 #include "content/public/browser/render_frame_host.h" 10 #include "content/public/browser/render_frame_host.h"
11 #include "content/public/browser/render_process_host.h" 11 #include "content/public/browser/render_process_host.h"
12 #include "content/public/browser/render_view_host.h" 12 #include "content/public/browser/render_view_host.h"
13 #include "content/public/browser/storage_partition.h"
13 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
14 #include "url/gurl.h" 15 #include "url/gurl.h"
15 16
16 namespace content { 17 namespace content {
17 18
18 DownloadUrlParameters::DownloadUrlParameters( 19 DownloadUrlParameters::DownloadUrlParameters(
19 const GURL& url, 20 const GURL& url,
20 int render_process_host_id, 21 int render_process_host_id,
21 int render_view_host_routing_id, 22 int render_view_host_routing_id,
22 int render_frame_host_routing_id, 23 int render_frame_host_routing_id,
23 ResourceContext* resource_context) 24 net::URLRequestContextGetter* url_request_context_getter)
24 : content_initiated_(false), 25 : content_initiated_(false),
25 method_("GET"), 26 method_("GET"),
26 post_id_(-1), 27 post_id_(-1),
27 prefer_cache_(false), 28 prefer_cache_(false),
28 render_process_host_id_(render_process_host_id), 29 render_process_host_id_(render_process_host_id),
29 render_view_host_routing_id_(render_view_host_routing_id), 30 render_view_host_routing_id_(render_view_host_routing_id),
30 render_frame_host_routing_id_(render_frame_host_routing_id), 31 render_frame_host_routing_id_(render_frame_host_routing_id),
31 resource_context_(resource_context), 32 url_request_context_getter_(url_request_context_getter),
32 url_(url), 33 url_(url),
33 do_not_prompt_for_login_(false) { 34 do_not_prompt_for_login_(false) {}
34 }
35 35
36 DownloadUrlParameters::~DownloadUrlParameters() { 36 DownloadUrlParameters::~DownloadUrlParameters() {
37 } 37 }
38 38
39 // static 39 // static
40 std::unique_ptr<DownloadUrlParameters> DownloadUrlParameters::FromWebContents( 40 std::unique_ptr<DownloadUrlParameters> DownloadUrlParameters::FromWebContents(
Charlie Reis 2016/05/05 21:43:23 I'm a bit concerned about this method, which assum
asanka 2016/05/07 00:24:45 I think this should be fixed, but I think that sh
Charlie Reis 2016/05/10 22:50:02 Ok. I wasn't sure how context menus worked for <w
asanka 2016/05/11 03:14:52 I was referring partly to https://codereview.chrom
41 WebContents* web_contents, 41 WebContents* web_contents,
42 const GURL& url) { 42 const GURL& url) {
43 RenderFrameHost* render_frame_host = web_contents->GetMainFrame();
44 StoragePartition* storage_partition = BrowserContext::GetStoragePartition(
45 web_contents->GetBrowserContext(), render_frame_host->GetSiteInstance());
43 return std::unique_ptr<DownloadUrlParameters>(new DownloadUrlParameters( 46 return std::unique_ptr<DownloadUrlParameters>(new DownloadUrlParameters(
44 url, web_contents->GetRenderProcessHost()->GetID(), 47 url, render_frame_host->GetProcess()->GetID(),
45 web_contents->GetRenderViewHost()->GetRoutingID(), 48 web_contents->GetRenderViewHost()->GetRoutingID(),
46 web_contents->GetMainFrame()->GetRoutingID(), 49 render_frame_host->GetRoutingID(),
47 web_contents->GetBrowserContext()->GetResourceContext())); 50 storage_partition->GetURLRequestContext()));
48 } 51 }
49 52
50 } // namespace content 53 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698