Remove friend classes from PasswordStore.
[chromium-blink-merge.git] / content / child / websocket_bridge.h
blobaa96dd75c09ba957672877c51774bad0e93e14e4
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.
5 #ifndef CONTENT_CHILD_WEBSOCKET_BRIDGE_H_
6 #define CONTENT_CHILD_WEBSOCKET_BRIDGE_H_
8 #include <stdint.h>
9 #include <string>
10 #include <vector>
12 #include "base/basictypes.h"
13 #include "content/common/websocket.h"
14 #include "ipc/ipc_message.h"
15 #include "third_party/WebKit/public/platform/WebSocketHandle.h"
16 #include "third_party/WebKit/public/platform/WebVector.h"
18 namespace blink {
19 class WebSerializedOrigin;
20 class WebString;
21 class WebURL;
22 } // namespace blink
24 namespace content {
26 class WebSocketBridge : public blink::WebSocketHandle {
27 public:
28 WebSocketBridge();
30 // Handles an IPC message from the browser process.
31 bool OnMessageReceived(const IPC::Message& message);
33 // WebSocketHandle functions.
34 virtual void connect(const blink::WebURL& url,
35 const blink::WebVector<blink::WebString>& protocols,
36 const blink::WebSerializedOrigin& origin,
37 blink::WebSocketHandleClient* client) OVERRIDE;
38 virtual void send(bool fin,
39 WebSocketHandle::MessageType type,
40 const char* data,
41 size_t size) OVERRIDE;
42 virtual void flowControl(int64_t quota) OVERRIDE;
43 virtual void close(unsigned short code,
44 const blink::WebString& reason) OVERRIDE;
46 virtual void Disconnect();
48 private:
49 virtual ~WebSocketBridge();
51 void DidConnect(bool fail,
52 const std::string& selected_protocol,
53 const std::string& extensions);
54 void DidStartOpeningHandshake(const WebSocketHandshakeRequest& request);
55 void DidFinishOpeningHandshake(const WebSocketHandshakeResponse& response);
56 void DidFail(const std::string& message);
57 void DidReceiveData(bool fin,
58 WebSocketMessageType type,
59 const std::vector<char>& data);
60 void DidReceiveFlowControl(int64_t quota);
61 void DidClose(bool was_clean, unsigned short code, const std::string& reason);
62 void DidStartClosingHandshake();
64 int channel_id_;
65 blink::WebSocketHandleClient* client_;
67 static const int kInvalidChannelId = -1;
70 } // namespace content
72 #endif // CONTENT_CHILD_WEBSOCKET_BRIDGE_H_