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

Unified Diff: net/websockets/websocket_event_interface.h

Issue 12764006: WebSocketChannel implementation (Closed) Base URL: http://git.chromium.org/chromium/src.git@web_socket_dispatcher
Patch Set: Fix potential NULL-pointer dereference in ProcessFrameChunks. Created 7 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
Index: net/websockets/websocket_event_interface.h
diff --git a/net/websockets/websocket_event_interface.h b/net/websockets/websocket_event_interface.h
new file mode 100644
index 0000000000000000000000000000000000000000..534db6e8976d7ff758d606c04c616ea21ac3e5ef
--- /dev/null
+++ b/net/websockets/websocket_event_interface.h
@@ -0,0 +1,45 @@
+// Copyright 2013 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.
+
+#ifndef NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_
+#define NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_
+
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+
+namespace net {
+
+// Interface for events sent from the network layer to the content layer. These
+// events will generally be sent as-is to the renderer process.
+class NET_EXPORT WebSocketEventInterface {
+ public:
+ typedef int WebSocketMessageType;
+ virtual ~WebSocketEventInterface() {}
+ // Provides the response to an AddChannelRequest.
+ virtual void OnAddChannelResponse(bool fail,
+ const std::string& selected_protocol) = 0;
+ // Send a frame to the renderer process.
+ virtual void OnSendFrame(bool fin,
+ WebSocketMessageType type,
+ const std::vector<char>& data) = 0;
+ // Provide more send quota to the renderer process.
+ virtual void OnFlowControl(int64 quota) = 0;
+ // Both the "reason" and "reason_text" are passed through to Javascript, so
+ // care must be taken not to provide details that could be useful to attackers
+ // attempting to use WebSockets to probe networks.
+ virtual void OnDropChannel(unsigned short reason,
+ const std::string& reason_text) = 0;
+
+ protected:
+ WebSocketEventInterface() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(WebSocketEventInterface);
+};
+
+} // namespace net
+
+#endif // NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_

Powered by Google App Engine
This is Rietveld 408576698