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

Unified Diff: content/renderer/websockethandle_impl.h

Issue 2279763003: Revert "Move WebSocketHandleImpl into Blink" (Closed)
Patch Set: Created 4 years, 4 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 | « content/renderer/renderer_blink_platform_impl.cc ('k') | content/renderer/websockethandle_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/websockethandle_impl.h
diff --git a/content/renderer/websockethandle_impl.h b/content/renderer/websockethandle_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..9afafce983d527557f22761b27fce858f8cc8acc
--- /dev/null
+++ b/content/renderer/websockethandle_impl.h
@@ -0,0 +1,86 @@
+// 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 CONTENT_RENDERER_WEBSOCKETHANDLE_IMPL_H_
+#define CONTENT_RENDERER_WEBSOCKETHANDLE_IMPL_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "base/macros.h"
+#include "base/single_thread_task_runner.h"
+#include "content/common/websocket.mojom.h"
+#include "mojo/public/cpp/bindings/binding.h"
+#include "third_party/WebKit/public/platform/WebVector.h"
+#include "third_party/WebKit/public/platform/modules/websockets/WebSocketHandle.h"
+
+namespace blink {
+class InterfaceProvider;
+class WebSecurityOrigin;
+class WebString;
+class WebURL;
+} // namespace blink
+
+namespace content {
+
+class WebSocketHandleImpl : public blink::WebSocketHandle,
+ public mojom::WebSocketClient {
+ public:
+ explicit WebSocketHandleImpl(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner);
+
+ // This method may optionally be called before connect() to specify a
+ // specific InterfaceProvider to get a WebSocket instance. By default,
+ // connect() will use blink::Platform::interfaceProvider().
+ void Initialize(blink::InterfaceProvider* interface_provider);
+
+ // blink::WebSocketHandle methods:
+ void connect(const blink::WebURL& url,
+ const blink::WebVector<blink::WebString>& protocols,
+ const blink::WebSecurityOrigin& origin,
+ const blink::WebURL& first_party_for_cookies,
+ const blink::WebString& user_agent_override,
+ blink::WebSocketHandleClient* client) override;
+ void send(bool fin,
+ WebSocketHandle::MessageType type,
+ const char* data,
+ size_t size) override;
+ void flowControl(int64_t quota) override;
+ void close(unsigned short code, const blink::WebString& reason) override;
+
+ private:
+ ~WebSocketHandleImpl() override;
+ void Disconnect();
+ void OnConnectionError();
+
+ // mojom::WebSocketClient methods:
+ void OnFailChannel(const std::string& reason) override;
+ void OnStartOpeningHandshake(
+ mojom::WebSocketHandshakeRequestPtr request) override;
+ void OnFinishOpeningHandshake(
+ mojom::WebSocketHandshakeResponsePtr response) override;
+ void OnAddChannelResponse(const std::string& selected_protocol,
+ const std::string& extensions) override;
+ void OnDataFrame(bool fin,
+ mojom::WebSocketMessageType type,
+ const std::vector<uint8_t>& data) override;
+ void OnFlowControl(int64_t quota) override;
+ void OnDropChannel(bool was_clean,
+ uint16_t code,
+ const std::string& reason) override;
+ void OnClosingHandshake() override;
+
+ blink::WebSocketHandleClient* client_;
+
+ mojom::WebSocketPtr websocket_;
+ mojo::Binding<mojom::WebSocketClient> client_binding_;
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+ bool did_initialize_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebSocketHandleImpl);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_WEBSOCKETHANDLE_IMPL_H_
« no previous file with comments | « content/renderer/renderer_blink_platform_impl.cc ('k') | content/renderer/websockethandle_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698