Disable signin-to-Chrome when using Guest profile.
[chromium-blink-merge.git] / content / child / websocket_bridge.h
blob159ff7712b7972f9381ad6c917206c905bbeaf74
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/WebString.h"
17 #include "third_party/WebKit/public/platform/WebURL.h"
18 #include "third_party/WebKit/public/platform/WebVector.h"
20 namespace content {
22 class WebSocketBridge : public blink::WebSocketHandle {
23 public:
24 WebSocketBridge();
26 // Handles an IPC message from the browser process.
27 bool OnMessageReceived(const IPC::Message& message);
29 // WebSocketHandle functions.
30 virtual void connect(const blink::WebURL& url,
31 const blink::WebVector<blink::WebString>& protocols,
32 const blink::WebString& origin,
33 blink::WebSocketHandleClient* client) OVERRIDE;
34 virtual void send(bool fin,
35 WebSocketHandle::MessageType type,
36 const char* data,
37 size_t size) OVERRIDE;
38 virtual void flowControl(int64_t quota) OVERRIDE;
39 virtual void close(unsigned short code,
40 const blink::WebString& reason) OVERRIDE;
42 virtual void Disconnect();
44 private:
45 virtual ~WebSocketBridge();
47 void DidConnect(bool fail,
48 const std::string& selected_protocol,
49 const std::string& extensions);
50 void DidStartOpeningHandshake(const WebSocketHandshakeRequest& request);
51 void DidFinishOpeningHandshake(const WebSocketHandshakeResponse& response);
52 void DidFail(const std::string& message);
53 void DidReceiveData(bool fin,
54 WebSocketMessageType type,
55 const std::vector<char>& data);
56 void DidReceiveFlowControl(int64_t quota);
57 void DidClose(bool was_clean, unsigned short code, const std::string& reason);
58 void DidStartClosingHandshake();
60 int channel_id_;
61 blink::WebSocketHandleClient* client_;
63 static const int kInvalidChannelId = -1;
66 } // namespace content
68 #endif // CONTENT_CHILD_WEBSOCKET_BRIDGE_H_