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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/public/platform/Platform.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/public/platform/WebSocketHandshakeThrottle.h
diff --git a/third_party/WebKit/public/platform/WebSocketHandshakeThrottle.h b/third_party/WebKit/public/platform/WebSocketHandshakeThrottle.h
new file mode 100644
index 0000000000000000000000000000000000000000..dfe09e19f8746ed74c2480d0b2f81a068b502076
--- /dev/null
+++ b/third_party/WebKit/public/platform/WebSocketHandshakeThrottle.h
@@ -0,0 +1,46 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// WebSocketHandshakeThrottle provides a facility for embedders to delay
+// WebSocket connection establishment. Specifically, at the same time as the
+// handshake is started blink::Platform::CreateWebSocketHandshakeThrottle() will
+// be called. If a non-null WebSocketHandshakeThrottle is returned then
+// ThrottleHandshake() will be called on it. If the result is error then the
+// handshake will be aborted, and a connection error will be reported to
+// Javascript. If the throttle hasn't reported a result when the WebSocket
+// handshake succeeds then Blink will wait for the throttle result before
+// reporting the connection is open to Javascript.
+
+#ifndef WebSocketHandshakeThrottle_h
+#define WebSocketHandshakeThrottle_h
+
+#include "public/platform/WebCallbacks.h"
+
+namespace blink {
+
+class WebURL;
+class WebLocalFrame;
+class WebString;
+
+// Embedders can implement this class to delay WebSocket connections.
+class WebSocketHandshakeThrottle {
+ public:
+ // Destruction implies that the handshake has been aborted. Any ongoing work
+ // should be cleaned up if possible.
+ virtual ~WebSocketHandshakeThrottle() {}
+
+ // The WebCallbacks OnSuccess or OnError should be called asychronously to
+ // permit Javascript to use the connection or not. OnError should be passed
+ // a message to be displayed on the console indicating why the handshake was
+ // blocked. This object will be destroyed synchronously inside the
+ // callbacks. Callbacks must not be called after this object has been
+ // destroyed.
+ virtual void ThrottleHandshake(const WebURL&,
+ WebLocalFrame*,
+ WebCallbacks<void, const WebString&>*) = 0;
+};
+
+} // namespace blink
+
+#endif // WebSocketHandshakeThrottle_h
« 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