Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: content/public/browser/resource_request_details.cc

Issue 226183015: Added HTTP response code field to ResourceRequestDetails. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Corrections after review. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/public/browser/resource_request_details.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.get() ?
31 request->response_info().headers.get()->response_code() : -1;
28 32
29 // If request is from the worker process on behalf of a renderer, use 33 // If request is from the worker process on behalf of a renderer, use
30 // the renderer process id, since it consumes the notification response 34 // the renderer process id, since it consumes the notification response
31 // such as ssl state etc. 35 // such as ssl state etc.
32 // TODO(atwilson): need to notify all associated renderers in the case 36 // TODO(atwilson): need to notify all associated renderers in the case
33 // of ssl state change (http://crbug.com/25357). For now, just notify 37 // of ssl state change (http://crbug.com/25357). For now, just notify
34 // the first one (works for dedicated workers and shared workers with 38 // the first one (works for dedicated workers and shared workers with
35 // a single process). 39 // a single process).
36 int worker_render_frame_id; 40 int worker_render_frame_id;
37 if (!WorkerServiceImpl::GetInstance()->GetRendererForWorker( 41 if (!WorkerServiceImpl::GetInstance()->GetRendererForWorker(
38 info->GetChildID(), &origin_child_id, &worker_render_frame_id)) { 42 info->GetChildID(), &origin_child_id, &worker_render_frame_id)) {
39 origin_child_id = info->GetChildID(); 43 origin_child_id = info->GetChildID();
40 } 44 }
41 } 45 }
42 46
43 ResourceRequestDetails::~ResourceRequestDetails() {} 47 ResourceRequestDetails::~ResourceRequestDetails() {}
44 48
45 ResourceRedirectDetails::ResourceRedirectDetails(const net::URLRequest* request, 49 ResourceRedirectDetails::ResourceRedirectDetails(const net::URLRequest* request,
46 int cert_id, 50 int cert_id,
47 const GURL& new_url) 51 const GURL& new_url)
48 : ResourceRequestDetails(request, cert_id), 52 : ResourceRequestDetails(request, cert_id),
49 new_url(new_url) { 53 new_url(new_url) {
50 } 54 }
51 55
52 ResourceRedirectDetails::~ResourceRedirectDetails() {} 56 ResourceRedirectDetails::~ResourceRedirectDetails() {}
53 57
54 } // namespace content 58 } // namespace content
OLDNEW
« no previous file with comments | « content/public/browser/resource_request_details.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698