| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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 // WebSocketHandshakeThrottle provides a facility for embedders to delay |
| 6 // WebSocket connection establishment. Specifically, at the same time as the |
| 7 // handshake is started blink::Platform::CreateWebSocketHandshakeThrottle() will |
| 8 // be called. If a non-null WebSocketHandshakeThrottle is returned then |
| 9 // ThrottleHandshake() will be called on it. If the result is error then the |
| 10 // handshake will be aborted, and a connection error will be reported to |
| 11 // Javascript. If the throttle hasn't reported a result when the WebSocket |
| 12 // handshake succeeds then Blink will wait for the throttle result before |
| 13 // reporting the connection is open to Javascript. |
| 14 |
| 15 #ifndef WebSocketHandshakeThrottle_h |
| 16 #define WebSocketHandshakeThrottle_h |
| 17 |
| 18 #include "public/platform/WebCallbacks.h" |
| 19 |
| 20 namespace blink { |
| 21 |
| 22 class WebURL; |
| 23 class WebLocalFrame; |
| 24 class WebString; |
| 25 |
| 26 // Embedders can implement this class to delay WebSocket connections. |
| 27 class WebSocketHandshakeThrottle { |
| 28 public: |
| 29 // Destruction implies that the handshake has been aborted. Any ongoing work |
| 30 // should be cleaned up if possible. |
| 31 virtual ~WebSocketHandshakeThrottle() {} |
| 32 |
| 33 // The WebCallbacks OnSuccess or OnError should be called asychronously to |
| 34 // permit Javascript to use the connection or not. OnError should be passed |
| 35 // a message to be displayed on the console indicating why the handshake was |
| 36 // blocked. This object will be destroyed synchronously inside the |
| 37 // callbacks. Callbacks must not be called after this object has been |
| 38 // destroyed. |
| 39 virtual void ThrottleHandshake(const WebURL&, |
| 40 WebLocalFrame*, |
| 41 WebCallbacks<void, const WebString&>*) = 0; |
| 42 }; |
| 43 |
| 44 } // namespace blink |
| 45 |
| 46 #endif // WebSocketHandshakeThrottle_h |
| OLD | NEW |