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 #ifndef CONTENT_PUBLIC_RENDERER_RESOURCE_DISPATCHER_DELEGATE_H_ 6 #define CONTENT_PUBLIC_RENDERER_RESOURCE_DISPATCHER_DELEGATE_H_ 7 8 #include <string> 9 10 #include "content/common/content_export.h" 11 12 class GURL; 13 14 namespace content { 15 16 class RequestPeer; 17 18 // Interface that allows observing request events and optionally replacing 19 // the peer. Note that if it doesn't replace the peer it must return the 20 // current peer so that the ownership is continued to be held by 21 // ResourceDispatcher. 22 class CONTENT_EXPORT ResourceDispatcherDelegate { 23 public: ~ResourceDispatcherDelegate()24 virtual ~ResourceDispatcherDelegate() {} 25 26 virtual void OnRequestComplete() = 0; 27 28 // Note that |url|, |referrer| and |method| are the final values (e.g. after 29 // any redirects). 30 virtual std::unique_ptr<RequestPeer> OnReceivedResponse( 31 std::unique_ptr<RequestPeer> current_peer, 32 const std::string& mime_type, 33 const GURL& url) = 0; 34 }; 35 36 } // namespace content 37 38 #endif // CONTENT_PUBLIC_RENDERER_RESOURCE_DISPATCHER_DELEGATE_H_ 39