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

Side by Side Diff: content/renderer/websockethandle_impl.h

Issue 2119973002: Port WebSockets to Mojo IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix shared worker support 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2013 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 #ifndef CONTENT_RENDERER_WEBSOCKETHANDLE_IMPL_H_
6 #define CONTENT_RENDERER_WEBSOCKETHANDLE_IMPL_H_
7
8 #include <stddef.h>
9 #include <stdint.h>
10
11 #include "base/macros.h"
12 #include "base/single_thread_task_runner.h"
13 #include "content/common/websocket.mojom.h"
14 #include "mojo/public/cpp/bindings/binding.h"
15 #include "third_party/WebKit/public/platform/WebVector.h"
16 #include "third_party/WebKit/public/platform/modules/websockets/WebSocketHandle. h"
17
18 namespace blink {
19 class InterfaceProvider;
20 class WebSecurityOrigin;
21 class WebString;
22 class WebURL;
23 } // namespace blink
24
25 namespace content {
26
27 class WebSocketHandleImpl : public blink::WebSocketHandle,
28 public mojom::WebSocketClient {
29 public:
30 explicit WebSocketHandleImpl(
31 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
32
33 void Initialize(blink::InterfaceProvider* interface_provider);
34
35 // blink::WebSocketHandle methods:
36 void connect(const blink::WebURL& url,
37 const blink::WebVector<blink::WebString>& protocols,
38 const blink::WebSecurityOrigin& origin,
39 const blink::WebURL& first_party_for_cookies,
40 const blink::WebString& user_agent_override,
41 blink::WebSocketHandleClient* client) override;
42 void send(bool fin,
43 WebSocketHandle::MessageType type,
44 const char* data,
45 size_t size) override;
46 void flowControl(int64_t quota) override;
47 void close(unsigned short code, const blink::WebString& reason) override;
48
49 private:
50 ~WebSocketHandleImpl() override;
51 void Disconnect();
52 void OnConnectionError();
53
54 // mojom::WebSocketClient methods:
55 void OnFailChannel(const mojo::String& reason) override;
56 void OnStartOpeningHandshake(
57 mojom::WebSocketHandshakeRequestPtr request) override;
58 void OnFinishOpeningHandshake(
59 mojom::WebSocketHandshakeResponsePtr response) override;
60 void OnAddChannelResponse(const mojo::String& selected_protocol,
61 const mojo::String& extensions) override;
62 void OnDataFrame(bool fin, mojom::WebSocketMessageType type,
63 mojo::Array<uint8_t> data) override;
64 void OnFlowControl(int64_t quota) override;
65 void OnDropChannel(bool was_clean, uint16_t code,
66 const mojo::String& reason) override;
67 void OnClosingHandshake() override;
68
69 blink::WebSocketHandleClient* client_;
70
71 mojom::WebSocketPtr websocket_;
72 mojo::Binding<mojom::WebSocketClient> client_binding_;
73 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
74 bool did_initialize_;
75
76 DISALLOW_COPY_AND_ASSIGN(WebSocketHandleImpl);
77 };
78
79 } // namespace content
80
81 #endif // CONTENT_RENDERER_WEBSOCKETHANDLE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698