OLD | NEW |
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/storage_partition.h" |
14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 DownloadUrlParameters::DownloadUrlParameters( | 19 DownloadUrlParameters::DownloadUrlParameters( |
20 const GURL& url, | 20 const GURL& url, |
| 21 net::URLRequestContextGetter* url_request_context_getter) |
| 22 : DownloadUrlParameters(url, -1, -1, -1, url_request_context_getter) { |
| 23 } |
| 24 |
| 25 DownloadUrlParameters::DownloadUrlParameters( |
| 26 const GURL& url, |
21 int render_process_host_id, | 27 int render_process_host_id, |
22 int render_view_host_routing_id, | 28 int render_view_host_routing_id, |
23 int render_frame_host_routing_id, | 29 int render_frame_host_routing_id, |
24 net::URLRequestContextGetter* url_request_context_getter) | 30 net::URLRequestContextGetter* url_request_context_getter) |
25 : content_initiated_(false), | 31 : content_initiated_(false), |
26 method_("GET"), | 32 method_("GET"), |
27 post_id_(-1), | 33 post_id_(-1), |
28 prefer_cache_(false), | 34 prefer_cache_(false), |
29 render_process_host_id_(render_process_host_id), | 35 render_process_host_id_(render_process_host_id), |
30 render_view_host_routing_id_(render_view_host_routing_id), | 36 render_view_host_routing_id_(render_view_host_routing_id), |
31 render_frame_host_routing_id_(render_frame_host_routing_id), | 37 render_frame_host_routing_id_(render_frame_host_routing_id), |
32 url_request_context_getter_(url_request_context_getter), | 38 url_request_context_getter_(url_request_context_getter), |
33 url_(url), | 39 url_(url), |
34 do_not_prompt_for_login_(false) {} | 40 do_not_prompt_for_login_(false) {} |
35 | 41 |
36 DownloadUrlParameters::~DownloadUrlParameters() { | 42 DownloadUrlParameters::~DownloadUrlParameters() { |
37 } | 43 } |
38 | 44 |
39 // static | 45 // static |
40 std::unique_ptr<DownloadUrlParameters> DownloadUrlParameters::FromWebContents( | 46 std::unique_ptr<DownloadUrlParameters> |
| 47 DownloadUrlParameters::CreateForWebContentsMainFrame( |
41 WebContents* web_contents, | 48 WebContents* web_contents, |
42 const GURL& url) { | 49 const GURL& url) { |
43 RenderFrameHost* render_frame_host = web_contents->GetMainFrame(); | 50 RenderFrameHost* render_frame_host = web_contents->GetMainFrame(); |
44 StoragePartition* storage_partition = BrowserContext::GetStoragePartition( | 51 StoragePartition* storage_partition = BrowserContext::GetStoragePartition( |
45 web_contents->GetBrowserContext(), render_frame_host->GetSiteInstance()); | 52 web_contents->GetBrowserContext(), render_frame_host->GetSiteInstance()); |
46 return std::unique_ptr<DownloadUrlParameters>(new DownloadUrlParameters( | 53 return std::unique_ptr<DownloadUrlParameters>(new DownloadUrlParameters( |
47 url, render_frame_host->GetProcess()->GetID(), | 54 url, render_frame_host->GetProcess()->GetID(), |
48 web_contents->GetRenderViewHost()->GetRoutingID(), | 55 render_frame_host->GetRenderViewHost()->GetRoutingID(), |
49 render_frame_host->GetRoutingID(), | 56 render_frame_host->GetRoutingID(), |
50 storage_partition->GetURLRequestContext())); | 57 storage_partition->GetURLRequestContext())); |
51 } | 58 } |
52 | 59 |
53 } // namespace content | 60 } // namespace content |
OLD | NEW |