1 // Copyright (c) 2013 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/browser/loader/resource_message_delegate.h" 6 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 8 #include "content/browser/loader/resource_request_info_impl.h" 9 #include "net/url_request/url_request.h" 10 11 namespace content { 12 13 ResourceMessageDelegate::ResourceMessageDelegate(const net::URLRequest* request) 14 : id_(ResourceRequestInfoImpl::ForRequest(request)->GetGlobalRequestID()) { 15 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); 16 rdh->RegisterResourceMessageDelegate(id_, this); 17 } 18 19 ResourceMessageDelegate::~ResourceMessageDelegate() { 20 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); 21 rdh->UnregisterResourceMessageDelegate(id_, this); 22 } 23 24 } // namespace content 25