Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(408)

Side by Side Diff: third_party/WebKit/public/platform/WebSocketHandshakeThrottle.h

Issue 2930263002: Add blink::WebSocketHandshakeThrottle (Closed)
Patch Set: Fixes from yhirano review Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/public/platform/Platform.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « third_party/WebKit/public/platform/Platform.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698