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. 4 5 #include "content/public/browser/resource_request_details.h" 6 7 #include "content/browser/worker_host/worker_service_impl.h" 8 #include "content/public/browser/resource_request_info.h" 9 #include "net/url_request/url_request.h" 10 11 namespace content { 12 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 frame_id = info->GetFrameID(); 28 29 // If request is from the worker process on behalf of a renderer, use 30 // the renderer process id, since it consumes the notification response 31 // such as ssl state etc. 32 // TODO(atwilson): need to notify all associated renderers in the case 33 // of ssl state change (http://crbug.com/25357). For now, just notify 34 // the first one (works for dedicated workers and shared workers with 35 // a single process). 36 if (!WorkerServiceImpl::GetInstance()->GetRendererForWorker( 37 info->GetChildID(), &origin_child_id, &origin_route_id)) { 38 origin_child_id = info->GetChildID(); 39 origin_route_id = info->GetRouteID(); 40 } 41 } 42 43 ResourceRequestDetails::~ResourceRequestDetails() {} 44 45 ResourceRedirectDetails::ResourceRedirectDetails(const net::URLRequest* request, 46 int cert_id, 47 const GURL& new_url) 48 : ResourceRequestDetails(request, cert_id), 49 new_url(new_url) { 50 } 51 52 ResourceRedirectDetails::~ResourceRedirectDetails() {} 53 54 } // namespace content 55