| 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 SocketType socket_type_; | 80 SocketType socket_type_; |
| 80 int src_id_; | 81 int src_id_; |
| 81 APIResourceEventNotifier* event_notifier_; | 82 APIResourceEventNotifier* event_notifier_; |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 class SocketDestroyFunction : public SocketExtensionFunction { | 85 class SocketDestroyFunction : public SocketExtensionFunction { |
| 85 public: | 86 public: |
| 86 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.destroy") | 87 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.destroy") |
| (...skipping 27 matching lines...) Expand all Loading... |
| 114 | 115 |
| 115 private: | 116 private: |
| 116 void StartConnect(); | 117 void StartConnect(); |
| 117 void OnConnect(int result); | 118 void OnConnect(int result); |
| 118 | 119 |
| 119 int socket_id_; | 120 int socket_id_; |
| 120 std::string hostname_; | 121 std::string hostname_; |
| 121 int port_; | 122 int port_; |
| 122 }; | 123 }; |
| 123 | 124 |
| 125 class SocketHandshakeFunction : public SocketExtensionFunction { |
| 126 public: |
| 127 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.handshake") |
| 128 |
| 129 protected: |
| 130 virtual ~SocketHandshakeFunction() {} |
| 131 |
| 132 // AsyncAPIFunction: |
| 133 virtual bool Prepare() OVERRIDE; |
| 134 virtual void AsyncWorkStart() OVERRIDE; |
| 135 void OnCompleted(int result); |
| 136 |
| 137 private: |
| 138 int socket_id_; |
| 139 std::string ssl_hostname_; |
| 140 int ssl_port_; |
| 141 }; |
| 142 |
| 124 class SocketDisconnectFunction : public SocketExtensionFunction { | 143 class SocketDisconnectFunction : public SocketExtensionFunction { |
| 125 public: | 144 public: |
| 126 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.disconnect") | 145 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.disconnect") |
| 127 | 146 |
| 128 protected: | 147 protected: |
| 129 virtual ~SocketDisconnectFunction() {} | 148 virtual ~SocketDisconnectFunction() {} |
| 130 | 149 |
| 131 // AsyncAPIFunction: | 150 // AsyncAPIFunction: |
| 132 virtual bool Prepare() OVERRIDE; | 151 virtual bool Prepare() OVERRIDE; |
| 133 virtual void Work() OVERRIDE; | 152 virtual void Work() OVERRIDE; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 virtual bool Prepare() OVERRIDE; | 288 virtual bool Prepare() OVERRIDE; |
| 270 virtual void Work() OVERRIDE; | 289 virtual void Work() OVERRIDE; |
| 271 | 290 |
| 272 private: | 291 private: |
| 273 scoped_ptr<api::experimental_socket::SetNoDelay::Params> params_; | 292 scoped_ptr<api::experimental_socket::SetNoDelay::Params> params_; |
| 274 }; | 293 }; |
| 275 | 294 |
| 276 } // namespace extensions | 295 } // namespace extensions |
| 277 | 296 |
| 278 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ | 297 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ |
| OLD | NEW |