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/resource_request_details.h" | 5 #include "content/public/browser/resource_request_details.h" |
6 | 6 |
7 #include "content/browser/worker_host/worker_service_impl.h" | 7 #include "content/browser/worker_host/worker_service_impl.h" |
8 #include "content/public/browser/resource_request_info.h" | 8 #include "content/public/browser/resource_request_info.h" |
9 #include "net/http/http_response_headers.h" | |
9 #include "net/url_request/url_request.h" | 10 #include "net/url_request/url_request.h" |
10 | 11 |
11 namespace content { | 12 namespace content { |
12 | 13 |
13 ResourceRequestDetails::ResourceRequestDetails(const net::URLRequest* request, | 14 ResourceRequestDetails::ResourceRequestDetails(const net::URLRequest* request, |
14 int cert_id) | 15 int cert_id) |
15 : url(request->url()), | 16 : url(request->url()), |
16 original_url(request->original_url()), | 17 original_url(request->original_url()), |
17 method(request->method()), | 18 method(request->method()), |
18 referrer(request->referrer()), | 19 referrer(request->referrer()), |
19 has_upload(request->has_upload()), | 20 has_upload(request->has_upload()), |
20 load_flags(request->load_flags()), | 21 load_flags(request->load_flags()), |
21 status(request->status()), | 22 status(request->status()), |
22 ssl_cert_id(cert_id), | 23 ssl_cert_id(cert_id), |
23 ssl_cert_status(request->ssl_info().cert_status), | 24 ssl_cert_status(request->ssl_info().cert_status), |
24 socket_address(request->GetSocketAddress()) { | 25 socket_address(request->GetSocketAddress()) { |
25 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 26 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
26 resource_type = info->GetResourceType(); | 27 resource_type = info->GetResourceType(); |
27 render_frame_id = info->GetRenderFrameID(); | 28 render_frame_id = info->GetRenderFrameID(); |
29 http_response_code = | |
30 request->response_info().headers ? | |
Charlie Reis
2014/04/08 23:22:29
Seems like we want a .get() here to be clear.
| |
31 request->response_info().headers.get()->response_code() | |
32 : -1; | |
Charlie Reis
2014/04/08 23:22:29
nit: The colon belongs on the previous line. (It'
| |
28 | 33 |
29 // If request is from the worker process on behalf of a renderer, use | 34 // If request is from the worker process on behalf of a renderer, use |
30 // the renderer process id, since it consumes the notification response | 35 // the renderer process id, since it consumes the notification response |
31 // such as ssl state etc. | 36 // such as ssl state etc. |
32 // TODO(atwilson): need to notify all associated renderers in the case | 37 // TODO(atwilson): need to notify all associated renderers in the case |
33 // of ssl state change (http://crbug.com/25357). For now, just notify | 38 // of ssl state change (http://crbug.com/25357). For now, just notify |
34 // the first one (works for dedicated workers and shared workers with | 39 // the first one (works for dedicated workers and shared workers with |
35 // a single process). | 40 // a single process). |
36 int worker_render_frame_id; | 41 int worker_render_frame_id; |
37 if (!WorkerServiceImpl::GetInstance()->GetRendererForWorker( | 42 if (!WorkerServiceImpl::GetInstance()->GetRendererForWorker( |
38 info->GetChildID(), &origin_child_id, &worker_render_frame_id)) { | 43 info->GetChildID(), &origin_child_id, &worker_render_frame_id)) { |
39 origin_child_id = info->GetChildID(); | 44 origin_child_id = info->GetChildID(); |
40 } | 45 } |
41 } | 46 } |
42 | 47 |
43 ResourceRequestDetails::~ResourceRequestDetails() {} | 48 ResourceRequestDetails::~ResourceRequestDetails() {} |
44 | 49 |
45 ResourceRedirectDetails::ResourceRedirectDetails(const net::URLRequest* request, | 50 ResourceRedirectDetails::ResourceRedirectDetails(const net::URLRequest* request, |
46 int cert_id, | 51 int cert_id, |
47 const GURL& new_url) | 52 const GURL& new_url) |
48 : ResourceRequestDetails(request, cert_id), | 53 : ResourceRequestDetails(request, cert_id), |
49 new_url(new_url) { | 54 new_url(new_url) { |
50 } | 55 } |
51 | 56 |
52 ResourceRedirectDetails::~ResourceRedirectDetails() {} | 57 ResourceRedirectDetails::~ResourceRedirectDetails() {} |
53 | 58 |
54 } // namespace content | 59 } // namespace content |
OLD | NEW |