| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/child/socket_stream_dispatcher.h" | 5 #include "content/child/socket_stream_dispatcher.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 class IPCWebSocketStreamHandleBridge : public WebSocketStreamHandleBridge { | 31 class IPCWebSocketStreamHandleBridge : public WebSocketStreamHandleBridge { |
| 32 public: | 32 public: |
| 33 IPCWebSocketStreamHandleBridge(blink::WebSocketStreamHandle* handle, | 33 IPCWebSocketStreamHandleBridge(blink::WebSocketStreamHandle* handle, |
| 34 WebSocketStreamHandleDelegate* delegate) | 34 WebSocketStreamHandleDelegate* delegate) |
| 35 : socket_id_(kNoSocketId), handle_(handle), delegate_(delegate) {} | 35 : socket_id_(kNoSocketId), handle_(handle), delegate_(delegate) {} |
| 36 | 36 |
| 37 // Returns the handle having given id or NULL if there is no such handle. | 37 // Returns the handle having given id or NULL if there is no such handle. |
| 38 static IPCWebSocketStreamHandleBridge* FromSocketId(int id); | 38 static IPCWebSocketStreamHandleBridge* FromSocketId(int id); |
| 39 | 39 |
| 40 // WebSocketStreamHandleBridge methods. | 40 // WebSocketStreamHandleBridge methods. |
| 41 virtual void Connect(const GURL& url) OVERRIDE; | 41 virtual void Connect(const GURL& url) override; |
| 42 virtual bool Send(const std::vector<char>& data) OVERRIDE; | 42 virtual bool Send(const std::vector<char>& data) override; |
| 43 virtual void Close() OVERRIDE; | 43 virtual void Close() override; |
| 44 | 44 |
| 45 // Called by SocketStreamDispatcher. | 45 // Called by SocketStreamDispatcher. |
| 46 void OnConnected(int max_amount_send_allowed); | 46 void OnConnected(int max_amount_send_allowed); |
| 47 void OnSentData(int amount_sent); | 47 void OnSentData(int amount_sent); |
| 48 void OnReceivedData(const std::vector<char>& data); | 48 void OnReceivedData(const std::vector<char>& data); |
| 49 void OnClosed(); | 49 void OnClosed(); |
| 50 void OnFailed(int error_code, const std::string& error_msg); | 50 void OnFailed(int error_code, const std::string& error_msg); |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 virtual ~IPCWebSocketStreamHandleBridge(); | 53 virtual ~IPCWebSocketStreamHandleBridge(); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 void SocketStreamDispatcher::OnFailed(int socket_id, int error_code) { | 246 void SocketStreamDispatcher::OnFailed(int socket_id, int error_code) { |
| 247 IPCWebSocketStreamHandleBridge* bridge = | 247 IPCWebSocketStreamHandleBridge* bridge = |
| 248 IPCWebSocketStreamHandleBridge::FromSocketId(socket_id); | 248 IPCWebSocketStreamHandleBridge::FromSocketId(socket_id); |
| 249 if (bridge) | 249 if (bridge) |
| 250 bridge->OnFailed(error_code, net::ErrorToString(error_code)); | 250 bridge->OnFailed(error_code, net::ErrorToString(error_code)); |
| 251 else | 251 else |
| 252 DLOG(ERROR) << "No bridge for socket_id=" << socket_id; | 252 DLOG(ERROR) << "No bridge for socket_id=" << socket_id; |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace content | 255 } // namespace content |
| OLD | NEW |