OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/renderer_host/resource_request_details.h" | 5 #include "chrome/browser/renderer_host/resource_request_details.h" |
6 | 6 |
7 #include "chrome/browser/worker_host/worker_service.h" | |
8 | |
7 ResourceRequestDetails::ResourceRequestDetails(const net::URLRequest* request, | 9 ResourceRequestDetails::ResourceRequestDetails(const net::URLRequest* request, |
8 int cert_id) | 10 int cert_id) |
9 : url_(request->url()), | 11 : url_(request->url()), |
10 original_url_(request->original_url()), | 12 original_url_(request->original_url()), |
11 method_(request->method()), | 13 method_(request->method()), |
12 referrer_(request->referrer()), | 14 referrer_(request->referrer()), |
13 has_upload_(request->has_upload()), | 15 has_upload_(request->has_upload()), |
14 load_flags_(request->load_flags()), | 16 load_flags_(request->load_flags()), |
15 status_(request->status()), | 17 status_(request->status()), |
16 ssl_cert_id_(cert_id), | 18 ssl_cert_id_(cert_id), |
17 ssl_cert_status_(request->ssl_info().cert_status) { | 19 ssl_cert_status_(request->ssl_info().cert_status) { |
18 const ResourceDispatcherHostRequestInfo* info = | 20 const ResourceDispatcherHostRequestInfo* info = |
19 ResourceDispatcherHost::InfoForRequest(request); | 21 ResourceDispatcherHost::InfoForRequest(request); |
20 DCHECK(info); | 22 DCHECK(info); |
21 resource_type_ = info->resource_type(); | 23 resource_type_ = info->resource_type(); |
22 frame_origin_ = info->frame_origin(); | 24 frame_origin_ = info->frame_origin(); |
23 main_frame_origin_ = info->main_frame_origin(); | 25 main_frame_origin_ = info->main_frame_origin(); |
24 | 26 |
25 // If request is from the worker process on behalf of a renderer, use | 27 // If request is from the worker process on behalf of a renderer, use |
26 // the renderer process id, since it consumes the notification response | 28 // the renderer process id, since it consumes the notification response |
27 // such as ssl state etc. | 29 // such as ssl state etc. |
28 const WorkerProcessHost::WorkerInstance* worker_instance = | 30 // TODO(atwilson): need to notify all associated renderers in the case |
29 WorkerService::GetInstance()->FindWorkerInstance(info->child_id()); | 31 // of ssl state change (http://crbug.com/25357). For now, just notify |
30 if (worker_instance) { | 32 // the first one (works for dedicated workers and shared workers with |
31 DCHECK(!worker_instance->worker_document_set()->IsEmpty()); | 33 // a single process). |
32 const WorkerDocumentSet::DocumentInfoSet& parents = | 34 int temp; |
33 worker_instance->worker_document_set()->documents(); | 35 if (!WorkerService::GetInstance()->GetRendererForWorker( |
34 // TODO(atwilson): need to notify all associated renderers in the case | 36 info->child_id(), &origin_child_id_, &temp)) { |
Andrew T Wilson (Slow)
2010/12/21 03:12:21
It seems cleaner to pass in a NULL ptr for unneede
jam
2010/12/21 07:41:51
I think it's personal taste :) I prefer not adding
| |
35 // of ssl state change (http://crbug.com/25357). For now, just notify | |
36 // the first one (works for dedicated workers and shared workers with | |
37 // a single process). | |
38 origin_child_id_ = parents.begin()->renderer_id(); | |
39 } else { | |
40 origin_child_id_ = info->child_id(); | 37 origin_child_id_ = info->child_id(); |
41 } | 38 } |
42 } | 39 } |
43 | 40 |
44 ResourceRequestDetails::~ResourceRequestDetails() {} | 41 ResourceRequestDetails::~ResourceRequestDetails() {} |
45 | 42 |
46 ResourceRedirectDetails::ResourceRedirectDetails(const net::URLRequest* request, | 43 ResourceRedirectDetails::ResourceRedirectDetails(const net::URLRequest* request, |
47 int cert_id, | 44 int cert_id, |
48 const GURL& new_url) | 45 const GURL& new_url) |
49 : ResourceRequestDetails(request, cert_id), | 46 : ResourceRequestDetails(request, cert_id), |
50 new_url_(new_url) { | 47 new_url_(new_url) { |
51 } | 48 } |
52 | 49 |
53 ResourceRedirectDetails::~ResourceRedirectDetails() {} | 50 ResourceRedirectDetails::~ResourceRedirectDetails() {} |
OLD | NEW |