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