| 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "chrome/browser/extensions/api/api_function.h" | 10 #include "chrome/browser/extensions/api/api_function.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 virtual ~SocketCreateFunction(); | 66 virtual ~SocketCreateFunction(); |
| 67 | 67 |
| 68 // AsyncAPIFunction: | 68 // AsyncAPIFunction: |
| 69 virtual bool Prepare() OVERRIDE; | 69 virtual bool Prepare() OVERRIDE; |
| 70 virtual void Work() OVERRIDE; | 70 virtual void Work() OVERRIDE; |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 enum SocketType { | 73 enum SocketType { |
| 74 kSocketTypeInvalid = -1, | 74 kSocketTypeInvalid = -1, |
| 75 kSocketTypeTCP, | 75 kSocketTypeTCP, |
| 76 kSocketTypeUDP | 76 kSocketTypeUDP, |
| 77 kSocketTypeSSL |
| 77 }; | 78 }; |
| 78 | 79 |
| 79 scoped_ptr<api::experimental_socket::Create::Params> params_; | 80 scoped_ptr<api::experimental_socket::Create::Params> params_; |
| 80 SocketType socket_type_; | 81 SocketType socket_type_; |
| 81 int src_id_; | 82 int src_id_; |
| 82 APIResourceEventNotifier* event_notifier_; | 83 APIResourceEventNotifier* event_notifier_; |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 class SocketDestroyFunction : public SocketExtensionFunction { | 86 class SocketDestroyFunction : public SocketExtensionFunction { |
| 86 public: | 87 public: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 115 | 116 |
| 116 private: | 117 private: |
| 117 void StartConnect(); | 118 void StartConnect(); |
| 118 void OnConnect(int result); | 119 void OnConnect(int result); |
| 119 | 120 |
| 120 int socket_id_; | 121 int socket_id_; |
| 121 std::string hostname_; | 122 std::string hostname_; |
| 122 int port_; | 123 int port_; |
| 123 }; | 124 }; |
| 124 | 125 |
| 126 class SocketHandshakeFunction : public SocketExtensionFunction { |
| 127 public: |
| 128 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.handshake") |
| 129 |
| 130 protected: |
| 131 virtual ~SocketHandshakeFunction() {} |
| 132 |
| 133 // AsyncAPIFunction: |
| 134 virtual bool Prepare() OVERRIDE; |
| 135 virtual void AsyncWorkStart() OVERRIDE; |
| 136 void OnCompleted(int result); |
| 137 |
| 138 private: |
| 139 int socket_id_; |
| 140 std::string ssl_hostname_; |
| 141 int ssl_port_; |
| 142 }; |
| 143 |
| 125 class SocketDisconnectFunction : public SocketExtensionFunction { | 144 class SocketDisconnectFunction : public SocketExtensionFunction { |
| 126 public: | 145 public: |
| 127 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.disconnect") | 146 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.disconnect") |
| 128 | 147 |
| 129 protected: | 148 protected: |
| 130 virtual ~SocketDisconnectFunction() {} | 149 virtual ~SocketDisconnectFunction() {} |
| 131 | 150 |
| 132 // AsyncAPIFunction: | 151 // AsyncAPIFunction: |
| 133 virtual bool Prepare() OVERRIDE; | 152 virtual bool Prepare() OVERRIDE; |
| 134 virtual void Work() OVERRIDE; | 153 virtual void Work() OVERRIDE; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 virtual bool Prepare() OVERRIDE; | 289 virtual bool Prepare() OVERRIDE; |
| 271 virtual void Work() OVERRIDE; | 290 virtual void Work() OVERRIDE; |
| 272 | 291 |
| 273 private: | 292 private: |
| 274 scoped_ptr<api::experimental_socket::SetNoDelay::Params> params_; | 293 scoped_ptr<api::experimental_socket::SetNoDelay::Params> params_; |
| 275 }; | 294 }; |
| 276 | 295 |
| 277 } // namespace extensions | 296 } // namespace extensions |
| 278 | 297 |
| 279 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ | 298 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ |
| OLD | NEW |