| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace chromeos { |
| 14 | 14 |
| 15 class WebSocketProxy { | 15 class WebSocketProxy { |
| 16 public: | 16 public: |
| 17 static const size_t kBufferLimit = 12 * 1024 * 1024; | 17 static const size_t kBufferLimit = 12 * 1024 * 1024; |
| 18 | 18 |
| 19 // Limits incoming websocket headers in initial stage of connection. | 19 // Limits incoming websocket headers in initial stage of connection. |
| 20 static const size_t kHeaderLimit = 32 * 1024; | 20 static const size_t kHeaderLimit = 32 * 1024; |
| 21 | 21 |
| 22 // Limits number of simultaneously open connections. | 22 // Limits number of simultaneously open connections. |
| 23 static const size_t kConnPoolLimit = 40; | 23 static const size_t kConnPoolLimit = 40; |
| 24 | 24 |
| 25 // Empty |allowed_origins| vector disables check for origin. | 25 WebSocketProxy(); |
| 26 explicit WebSocketProxy(const std::vector<std::string>& allowed_origins); | |
| 27 ~WebSocketProxy(); | 26 ~WebSocketProxy(); |
| 28 | 27 |
| 29 // Do not call it twice. | 28 // Do not call it twice. |
| 30 void Run(); | 29 void Run(); |
| 31 | 30 |
| 32 // Terminates running server (should be called on a different thread). | 31 // Terminates running server (should be called on a different thread). |
| 33 void Shutdown(); | 32 void Shutdown(); |
| 34 | 33 |
| 35 // Call this on network change. | 34 // Call this on network change. |
| 36 void OnNetworkChange(); | 35 void OnNetworkChange(); |
| 37 | 36 |
| 38 private: | 37 private: |
| 39 void* impl_; | 38 void* impl_; |
| 40 | 39 |
| 41 DISALLOW_COPY_AND_ASSIGN(WebSocketProxy); | 40 DISALLOW_COPY_AND_ASSIGN(WebSocketProxy); |
| 42 }; | 41 }; |
| 43 | 42 |
| 44 } // namespace chromeos | 43 } // namespace chromeos |
| 45 | 44 |
| 46 #endif // CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_H_ | 45 #endif // CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_H_ |
| OLD | NEW |