OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_CHILD_WEBSOCKET_BRIDGE_H_ | 5 #ifndef CONTENT_CHILD_WEBSOCKET_BRIDGE_H_ |
6 #define CONTENT_CHILD_WEBSOCKET_BRIDGE_H_ | 6 #define CONTENT_CHILD_WEBSOCKET_BRIDGE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "content/common/websocket.h" | 13 #include "content/common/websocket.h" |
14 #include "ipc/ipc_message.h" | 14 #include "ipc/ipc_message.h" |
15 #include "third_party/WebKit/public/platform/WebSocketHandle.h" | 15 #include "third_party/WebKit/public/platform/WebSocketHandle.h" |
16 #include "third_party/WebKit/public/platform/WebString.h" | 16 #include "third_party/WebKit/public/platform/WebString.h" |
17 #include "third_party/WebKit/public/platform/WebURL.h" | 17 #include "third_party/WebKit/public/platform/WebURL.h" |
18 #include "third_party/WebKit/public/platform/WebVector.h" | 18 #include "third_party/WebKit/public/platform/WebVector.h" |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 class WebSocketBridge : public WebKit::WebSocketHandle { | 22 class WebSocketBridge : public blink::WebSocketHandle { |
23 public: | 23 public: |
24 WebSocketBridge(); | 24 WebSocketBridge(); |
25 | 25 |
26 // Handles an IPC message from the browser process. | 26 // Handles an IPC message from the browser process. |
27 bool OnMessageReceived(const IPC::Message& message); | 27 bool OnMessageReceived(const IPC::Message& message); |
28 | 28 |
29 // WebSocketHandle functions. | 29 // WebSocketHandle functions. |
30 virtual void connect(const WebKit::WebURL& url, | 30 virtual void connect(const blink::WebURL& url, |
31 const WebKit::WebVector<WebKit::WebString>& protocols, | 31 const blink::WebVector<blink::WebString>& protocols, |
32 const WebKit::WebString& origin, | 32 const blink::WebString& origin, |
33 WebKit::WebSocketHandleClient* client) OVERRIDE; | 33 blink::WebSocketHandleClient* client) OVERRIDE; |
34 virtual void send(bool fin, | 34 virtual void send(bool fin, |
35 WebSocketHandle::MessageType type, | 35 WebSocketHandle::MessageType type, |
36 const char* data, | 36 const char* data, |
37 size_t size) OVERRIDE; | 37 size_t size) OVERRIDE; |
38 virtual void flowControl(int64_t quota) OVERRIDE; | 38 virtual void flowControl(int64_t quota) OVERRIDE; |
39 virtual void close(unsigned short code, | 39 virtual void close(unsigned short code, |
40 const WebKit::WebString& reason) OVERRIDE; | 40 const blink::WebString& reason) OVERRIDE; |
41 | 41 |
42 virtual void Disconnect(); | 42 virtual void Disconnect(); |
43 | 43 |
44 private: | 44 private: |
45 virtual ~WebSocketBridge(); | 45 virtual ~WebSocketBridge(); |
46 | 46 |
47 void DidConnect(bool fail, | 47 void DidConnect(bool fail, |
48 const std::string& selected_protocol, | 48 const std::string& selected_protocol, |
49 const std::string& extensions); | 49 const std::string& extensions); |
50 void DidFail(const std::string& message); | 50 void DidFail(const std::string& message); |
51 void DidReceiveData(bool fin, | 51 void DidReceiveData(bool fin, |
52 WebSocketMessageType type, | 52 WebSocketMessageType type, |
53 const std::vector<char>& data); | 53 const std::vector<char>& data); |
54 void DidReceiveFlowControl(int64_t quota); | 54 void DidReceiveFlowControl(int64_t quota); |
55 void DidClose(bool was_clean, unsigned short code, const std::string& reason); | 55 void DidClose(bool was_clean, unsigned short code, const std::string& reason); |
56 | 56 |
57 int channel_id_; | 57 int channel_id_; |
58 WebKit::WebSocketHandleClient* client_; | 58 blink::WebSocketHandleClient* client_; |
59 | 59 |
60 static const int kInvalidChannelId = -1; | 60 static const int kInvalidChannelId = -1; |
61 }; | 61 }; |
62 | 62 |
63 } // namespace content | 63 } // namespace content |
64 | 64 |
65 #endif // CONTENT_CHILD_WEBSOCKET_BRIDGE_H_ | 65 #endif // CONTENT_CHILD_WEBSOCKET_BRIDGE_H_ |
OLD | NEW |