1 // Copyright 2016 The Chromium Authors 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 NET_SPDY_SERVER_PUSH_DELEGATE_H_ 6 #define NET_SPDY_SERVER_PUSH_DELEGATE_H_ 7 8 #include <memory> 9 10 #include "net/base/net_export.h" 11 #include "net/log/net_log_with_source.h" 12 #include "url/gurl.h" 13 14 namespace net { 15 16 // An interface to a class that should be notified when session receives server 17 // push. 18 class NET_EXPORT_PRIVATE ServerPushDelegate { 19 public: 20 // An interface to a class that reflects information on the pushed request. 21 class NET_EXPORT ServerPushHelper { 22 public: 23 virtual ~ServerPushHelper() = default; 24 25 // Cancels the push if it is not claimed yet. 26 virtual void Cancel() = 0; 27 28 // Gets the URL of the pushed request. 29 virtual const GURL& GetURL() const = 0; 30 31 // Gets the network anonymization key for the pushed request. 32 virtual NetworkAnonymizationKey GetNetworkAnonymizationKey() const = 0; 33 }; 34 35 virtual ~ServerPushDelegate() = default; 36 37 // Invoked by session when a push promise has been received. 38 virtual void OnPush(std::unique_ptr<ServerPushHelper> push_helper, 39 const NetLogWithSource& session_net_log) = 0; 40 }; 41 42 } // namespace net 43 44 #endif // NET_SPDY_SERVER_PUSH_DELEGATE_H_ 45