Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / public / browser / download_url_parameters.cc
blobe7c632885af92e75bc843abd262ea17b0789460f
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
3 // found in the LICENSE file.
5 #include "content/public/browser/download_url_parameters.h"
7 #include "base/callback.h"
8 #include "content/public/browser/browser_context.h"
9 #include "content/public/browser/download_save_info.h"
10 #include "content/public/browser/render_process_host.h"
11 #include "content/public/browser/render_view_host.h"
12 #include "content/public/browser/web_contents.h"
13 #include "url/gurl.h"
15 namespace content {
17 DownloadUrlParameters::DownloadUrlParameters(
18 const GURL& url,
19 int render_process_host_id,
20 int render_view_host_routing_id,
21 ResourceContext* resource_context)
22 : content_initiated_(false),
23 method_("GET"),
24 post_id_(-1),
25 prefer_cache_(false),
26 render_process_host_id_(render_process_host_id),
27 render_view_host_routing_id_(render_view_host_routing_id),
28 resource_context_(resource_context),
29 url_(url),
30 do_not_prompt_for_login_(false) {
33 DownloadUrlParameters::~DownloadUrlParameters() {
36 // static
37 DownloadUrlParameters* DownloadUrlParameters::FromWebContents(
38 WebContents* web_contents,
39 const GURL& url) {
40 return new DownloadUrlParameters(
41 url,
42 web_contents->GetRenderProcessHost()->GetID(),
43 web_contents->GetRenderViewHost()->GetRoutingID(),
44 web_contents->GetBrowserContext()->GetResourceContext());
47 } // namespace content