server_push_delegate.h 1.3 KB

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