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_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
11 #include "content/public/browser/render_view_host.h" | 11 #include "content/public/browser/render_view_host.h" |
12 #include "content/public/browser/resource_dispatcher_host.h" | 12 #include "content/public/browser/resource_dispatcher_host.h" |
13 #include "content/public/browser/web_contents.h" | 13 #include "content/public/browser/web_contents.h" |
14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 DownloadUrlParameters::DownloadUrlParameters( | 18 DownloadUrlParameters::DownloadUrlParameters( |
19 const GURL& url, | 19 const GURL& url, |
20 int render_process_host_id, | 20 int render_process_host_id, |
21 int render_view_host_routing_id, | 21 int render_view_host_routing_id, |
22 ResourceContext* resource_context, | 22 ResourceContext* resource_context, |
23 const DownloadSaveInfo& save_info) | 23 scoped_ptr<DownloadSaveInfo> save_info) |
24 : content_initiated_(false), | 24 : content_initiated_(false), |
25 load_flags_(0), | 25 load_flags_(0), |
26 method_("GET"), | 26 method_("GET"), |
27 post_id_(-1), | 27 post_id_(-1), |
28 prefer_cache_(false), | 28 prefer_cache_(false), |
29 render_process_host_id_(render_process_host_id), | 29 render_process_host_id_(render_process_host_id), |
30 render_view_host_routing_id_(render_view_host_routing_id), | 30 render_view_host_routing_id_(render_view_host_routing_id), |
31 resource_context_(resource_context), | 31 resource_context_(resource_context), |
32 resource_dispatcher_host_(ResourceDispatcherHost::Get()), | 32 resource_dispatcher_host_(ResourceDispatcherHost::Get()), |
33 save_info_(save_info), | 33 save_info_(save_info.Pass()), |
34 url_(url) { | 34 url_(url) { |
35 DCHECK(resource_dispatcher_host_); | 35 DCHECK(resource_dispatcher_host_); |
36 } | 36 } |
37 | 37 |
38 DownloadUrlParameters::~DownloadUrlParameters() { | 38 DownloadUrlParameters::~DownloadUrlParameters() { |
39 } | 39 } |
40 | 40 |
41 // static | 41 // static |
42 DownloadUrlParameters* DownloadUrlParameters::FromWebContents( | 42 DownloadUrlParameters* DownloadUrlParameters::FromWebContents( |
43 WebContents* web_contents, | 43 WebContents* web_contents, |
44 const GURL& url, | 44 const GURL& url, |
45 const DownloadSaveInfo& save_info) { | 45 scoped_ptr<DownloadSaveInfo> save_info) { |
46 return new DownloadUrlParameters( | 46 return new DownloadUrlParameters( |
47 url, | 47 url, |
48 web_contents->GetRenderProcessHost()->GetID(), | 48 web_contents->GetRenderProcessHost()->GetID(), |
49 web_contents->GetRenderViewHost()->GetRoutingID(), | 49 web_contents->GetRenderViewHost()->GetRoutingID(), |
50 web_contents->GetBrowserContext()->GetResourceContext(), | 50 web_contents->GetBrowserContext()->GetResourceContext(), |
51 save_info); | 51 save_info.Pass()); |
| 52 } |
| 53 |
| 54 scoped_ptr<DownloadSaveInfo> DownloadUrlParameters::GetSaveInfo() { |
| 55 return save_info_.Pass(); |
52 } | 56 } |
53 | 57 |
54 } // namespace content | 58 } // namespace content |
OLD | NEW |