| 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_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 "chrome/browser/extensions/extension_function.h" | 9 #include "chrome/browser/extensions/extension_function.h" |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 void RespondOnUIThread(); | 38 void RespondOnUIThread(); |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // Many of these socket functions are synchronous in the sense that | 41 // Many of these socket functions are synchronous in the sense that |
| 42 // they don't involve blocking operations, but we've made them all | 42 // they don't involve blocking operations, but we've made them all |
| 43 // AsyncExtensionFunctions because the underlying UDPClientSocket | 43 // AsyncExtensionFunctions because the underlying UDPClientSocket |
| 44 // library wants all operations to happen on the same thread as the | 44 // library wants all operations to happen on the same thread as the |
| 45 // one that created the socket. Too bad. | 45 // one that created the socket. Too bad. |
| 46 | 46 |
| 47 class SocketCreateFunction : public SocketApiFunction { | 47 class SocketCreateFunction : public SocketApiFunction { |
| 48 public: |
| 49 SocketCreateFunction(); |
| 50 |
| 48 protected: | 51 protected: |
| 49 virtual bool Prepare() OVERRIDE; | 52 virtual bool Prepare() OVERRIDE; |
| 50 virtual void Work() OVERRIDE; | 53 virtual void Work() OVERRIDE; |
| 51 virtual bool Respond() OVERRIDE; | 54 virtual bool Respond() OVERRIDE; |
| 52 | 55 |
| 56 private: |
| 57 int src_id_; |
| 58 |
| 53 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.create") | 59 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.create") |
| 54 }; | 60 }; |
| 55 | 61 |
| 56 class SocketDestroyFunction : public SocketApiFunction { | 62 class SocketDestroyFunction : public SocketApiFunction { |
| 57 protected: | 63 protected: |
| 58 virtual bool Prepare() OVERRIDE; | 64 virtual bool Prepare() OVERRIDE; |
| 59 virtual void Work() OVERRIDE; | 65 virtual void Work() OVERRIDE; |
| 60 virtual bool Respond() OVERRIDE; | 66 virtual bool Respond() OVERRIDE; |
| 61 | 67 |
| 62 private: | 68 private: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 private: | 106 private: |
| 101 int socket_id_; | 107 int socket_id_; |
| 102 std::string message_; | 108 std::string message_; |
| 103 | 109 |
| 104 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.write") | 110 DECLARE_EXTENSION_FUNCTION_NAME("experimental.socket.write") |
| 105 }; | 111 }; |
| 106 | 112 |
| 107 } // namespace extensions | 113 } // namespace extensions |
| 108 | 114 |
| 109 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ | 115 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ |
| OLD | NEW |