| 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_COMMON_WEBSOCKET_H_ | 5 #ifndef CONTENT_COMMON_WEBSOCKET_H_ |
| 6 #define CONTENT_COMMON_WEBSOCKET_H_ | 6 #define CONTENT_COMMON_WEBSOCKET_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/strings/string_split.h" |
| 12 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 13 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 | 17 |
| 17 // WebSocket data message types sent between the browser and renderer processes. | 18 // WebSocket data message types sent between the browser and renderer processes. |
| 18 enum WebSocketMessageType { | 19 enum WebSocketMessageType { |
| 19 WEB_SOCKET_MESSAGE_TYPE_CONTINUATION = 0x0, | 20 WEB_SOCKET_MESSAGE_TYPE_CONTINUATION = 0x0, |
| 20 WEB_SOCKET_MESSAGE_TYPE_TEXT = 0x1, | 21 WEB_SOCKET_MESSAGE_TYPE_TEXT = 0x1, |
| 21 WEB_SOCKET_MESSAGE_TYPE_BINARY = 0x2, | 22 WEB_SOCKET_MESSAGE_TYPE_BINARY = 0x2, |
| 22 WEB_SOCKET_MESSAGE_TYPE_LAST = WEB_SOCKET_MESSAGE_TYPE_BINARY | 23 WEB_SOCKET_MESSAGE_TYPE_LAST = WEB_SOCKET_MESSAGE_TYPE_BINARY |
| 23 }; | 24 }; |
| 24 | 25 |
| 25 // Opening handshake request information which will be shown in the inspector. | 26 // Opening handshake request information which will be shown in the inspector. |
| 26 // All string data should be encoded to ASCII in the browser process. | 27 // All string data should be encoded to ASCII in the browser process. |
| 27 struct WebSocketHandshakeRequest { | 28 struct WebSocketHandshakeRequest { |
| 28 WebSocketHandshakeRequest(); | 29 WebSocketHandshakeRequest(); |
| 29 ~WebSocketHandshakeRequest(); | 30 ~WebSocketHandshakeRequest(); |
| 30 | 31 |
| 31 // The request URL | 32 // The request URL |
| 32 GURL url; | 33 GURL url; |
| 33 // Additional HTTP request headers | 34 // Additional HTTP request headers |
| 34 std::vector<std::pair<std::string, std::string> > headers; | 35 base::StringPairs headers; |
| 35 // HTTP request headers raw string | 36 // HTTP request headers raw string |
| 36 std::string headers_text; | 37 std::string headers_text; |
| 37 // The time that this request is sent | 38 // The time that this request is sent |
| 38 base::Time request_time; | 39 base::Time request_time; |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 // Opening handshake response information which will be shown in the inspector. | 42 // Opening handshake response information which will be shown in the inspector. |
| 42 // All string data should be encoded to ASCII in the browser process. | 43 // All string data should be encoded to ASCII in the browser process. |
| 43 struct WebSocketHandshakeResponse { | 44 struct WebSocketHandshakeResponse { |
| 44 WebSocketHandshakeResponse(); | 45 WebSocketHandshakeResponse(); |
| 45 ~WebSocketHandshakeResponse(); | 46 ~WebSocketHandshakeResponse(); |
| 46 | 47 |
| 47 // The request URL | 48 // The request URL |
| 48 GURL url; | 49 GURL url; |
| 49 // HTTP status code | 50 // HTTP status code |
| 50 int status_code; | 51 int status_code; |
| 51 // HTTP status text | 52 // HTTP status text |
| 52 std::string status_text; | 53 std::string status_text; |
| 53 // Additional HTTP response headers | 54 // Additional HTTP response headers |
| 54 std::vector<std::pair<std::string, std::string> > headers; | 55 std::vector<std::pair<std::string, std::string> > headers; |
| 55 // HTTP response headers raw string | 56 // HTTP response headers raw string |
| 56 std::string headers_text; | 57 std::string headers_text; |
| 57 // The time that this response arrives | 58 // The time that this response arrives |
| 58 base::Time response_time; | 59 base::Time response_time; |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 } // namespace content | 62 } // namespace content |
| 62 | 63 |
| 63 #endif // CONTENT_COMMON_WEBSOCKET_H_ | 64 #endif // CONTENT_COMMON_WEBSOCKET_H_ |
| OLD | NEW |