zhongyi | 7465c1b | 2016-11-11 01:38:05 | [diff] [blame] | 1 | // Copyright (c) 2016 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 | |
Bence Béky | 94658bf | 2018-05-11 19:22:58 | [diff] [blame] | 5 | #ifndef NET_SPDY_SERVER_PUSH_DELEGATE_H_ |
| 6 | #define NET_SPDY_SERVER_PUSH_DELEGATE_H_ |
bnc | 2da0f014 | 2017-05-12 20:08:05 | [diff] [blame] | 7 | |
| 8 | #include <memory> |
zhongyi | 7465c1b | 2016-11-11 01:38:05 | [diff] [blame] | 9 | |
| 10 | #include "net/base/net_export.h" |
zhongyi | d2a4cae | 2017-02-11 10:54:38 | [diff] [blame] | 11 | #include "net/log/net_log_with_source.h" |
zhongyi | 7465c1b | 2016-11-11 01:38:05 | [diff] [blame] | 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() {} |
| 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. |
zhongyi | d2a4cae | 2017-02-11 10:54:38 | [diff] [blame] | 29 | virtual const GURL& GetURL() const = 0; |
zhongyi | 7465c1b | 2016-11-11 01:38:05 | [diff] [blame] | 30 | }; |
| 31 | |
| 32 | virtual ~ServerPushDelegate() {} |
| 33 | |
| 34 | // Invoked by session when a push promise has been received. |
zhongyi | d2a4cae | 2017-02-11 10:54:38 | [diff] [blame] | 35 | virtual void OnPush(std::unique_ptr<ServerPushHelper> push_helper, |
| 36 | const NetLogWithSource& session_net_log) = 0; |
zhongyi | 7465c1b | 2016-11-11 01:38:05 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | } // namespace net |
| 40 | |
Bence Béky | 94658bf | 2018-05-11 19:22:58 | [diff] [blame] | 41 | #endif // NET_SPDY_SERVER_PUSH_DELEGATE_H_ |