Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / public / browser / resource_request_details.cc
blobad5f47e17341230d951ac8e6770db54556276548
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/resource_request_details.h"
7 #include "content/public/browser/resource_request_info.h"
8 #include "net/http/http_response_headers.h"
9 #include "net/url_request/url_request.h"
11 namespace content {
13 ResourceRequestDetails::ResourceRequestDetails(const net::URLRequest* request,
14 int cert_id)
15 : url(request->url()),
16 original_url(request->original_url()),
17 method(request->method()),
18 referrer(request->referrer()),
19 has_upload(request->has_upload()),
20 load_flags(request->load_flags()),
21 status(request->status()),
22 ssl_cert_id(cert_id),
23 ssl_cert_status(request->ssl_info().cert_status),
24 socket_address(request->GetSocketAddress()) {
25 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
26 resource_type = info->GetResourceType();
27 render_frame_id = info->GetRenderFrameID();
28 http_response_code =
29 request->response_info().headers.get() ?
30 request->response_info().headers.get()->response_code() : -1;
31 origin_child_id = info->GetChildID();
34 ResourceRequestDetails::~ResourceRequestDetails() {}
36 ResourceRedirectDetails::ResourceRedirectDetails(const net::URLRequest* request,
37 int cert_id,
38 const GURL& new_url)
39 : ResourceRequestDetails(request, cert_id),
40 new_url(new_url) {
43 ResourceRedirectDetails::~ResourceRedirectDetails() {}
45 } // namespace content