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/browser/worker_host/worker_service_impl.h"
8 #include "content/public/browser/resource_request_info.h"
9 #include "net/http/http_response_headers.h"
10 #include "net/url_request/url_request.h"
14 ResourceRequestDetails::ResourceRequestDetails(const net::URLRequest
* request
,
16 : url(request
->url()),
17 original_url(request
->original_url()),
18 method(request
->method()),
19 referrer(request
->referrer()),
20 has_upload(request
->has_upload()),
21 load_flags(request
->load_flags()),
22 status(request
->status()),
24 ssl_cert_status(request
->ssl_info().cert_status
),
25 socket_address(request
->GetSocketAddress()) {
26 const ResourceRequestInfo
* info
= ResourceRequestInfo::ForRequest(request
);
27 resource_type
= info
->GetResourceType();
28 render_frame_id
= info
->GetRenderFrameID();
30 request
->response_info().headers
.get() ?
31 request
->response_info().headers
.get()->response_code() : -1;
33 // If request is from the worker process on behalf of a renderer, use
34 // the renderer process id, since it consumes the notification response
35 // such as ssl state etc.
36 // TODO(atwilson): need to notify all associated renderers in the case
37 // of ssl state change (http://crbug.com/25357). For now, just notify
38 // the first one (works for dedicated workers and shared workers with
40 int worker_render_frame_id
;
41 if (!WorkerServiceImpl::GetInstance()->GetRendererForWorker(
42 info
->GetChildID(), &origin_child_id
, &worker_render_frame_id
)) {
43 origin_child_id
= info
->GetChildID();
47 ResourceRequestDetails::~ResourceRequestDetails() {}
49 ResourceRedirectDetails::ResourceRedirectDetails(const net::URLRequest
* request
,
52 : ResourceRequestDetails(request
, cert_id
),
56 ResourceRedirectDetails::~ResourceRedirectDetails() {}
58 } // namespace content