| 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_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_CONTROLLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 namespace chromeos { | 12 namespace chromeos { |
| 13 | 13 |
| 14 // Fills vector with extensions IDs which are allowed to use private | |
| 15 // extension API (WebSocketProxyPrivate, InputMethodPrivate, etc.) | |
| 16 void FillWithExtensionsIdsWithPrivateAccess(std::vector<std::string>* ids); | |
| 17 | |
| 18 // Controls webproxy to TCP service. | 14 // Controls webproxy to TCP service. |
| 19 class WebSocketProxyController { | 15 class WebSocketProxyController { |
| 20 public: | 16 public: |
| 21 enum ConnectionFlags { | 17 enum ConnectionFlags { |
| 22 PLAIN_TCP = 0, | 18 PLAIN_TCP = 0, |
| 23 TLS_OVER_TCP = 1 << 0 | 19 TLS_OVER_TCP = 1 << 0 |
| 24 }; | 20 }; |
| 25 | 21 |
| 26 // Can be called on any thread. Subsequent calls are cheap and do nothing. | 22 // Can be called on any thread. Subsequent calls are cheap and do nothing. |
| 27 static void Initiate(); | 23 static void Initiate(); |
| 28 | 24 |
| 29 // All methods can be called on any thread. | 25 // All methods can be called on any thread. |
| 30 static void Shutdown(); | 26 static void Shutdown(); |
| 31 static bool IsInitiated(); | 27 static bool IsInitiated(); |
| 32 static int GetPort(); // Returns port listening websocket connections. | 28 static int GetPort(); // Returns port listening websocket connections. |
| 33 | |
| 34 static bool CheckCredentials( | |
| 35 const std::string& extension_id, | |
| 36 const std::string& hostname, | |
| 37 unsigned short port, | |
| 38 ConnectionFlags); | |
| 39 }; | 29 }; |
| 40 | 30 |
| 41 } // namespace chromeos | 31 } // namespace chromeos |
| 42 | 32 |
| 43 #endif // CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_CONTROLLER_H_ | 33 #endif // CHROME_BROWSER_CHROMEOS_WEB_SOCKET_PROXY_CONTROLLER_H_ |
| OLD | NEW |