| 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 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "chrome/browser/extensions/api/api_function.h" | 9 #include "chrome/browser/extensions/api/api_function.h" |
| 10 #include "chrome/browser/extensions/api/api_resource_manager.h" | 10 #include "chrome/browser/extensions/api/api_resource_manager.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 public: | 30 public: |
| 31 SocketAsyncApiFunction(); | 31 SocketAsyncApiFunction(); |
| 32 | 32 |
| 33 protected: | 33 protected: |
| 34 virtual ~SocketAsyncApiFunction(); | 34 virtual ~SocketAsyncApiFunction(); |
| 35 | 35 |
| 36 // AsyncApiFunction: | 36 // AsyncApiFunction: |
| 37 virtual bool PrePrepare() OVERRIDE; | 37 virtual bool PrePrepare() OVERRIDE; |
| 38 virtual bool Respond() OVERRIDE; | 38 virtual bool Respond() OVERRIDE; |
| 39 | 39 |
| 40 Socket* GetSocket(int api_resource_id); |
| 41 void RemoveSocket(int api_resource_id); |
| 42 |
| 40 ApiResourceManager<Socket>* manager_; | 43 ApiResourceManager<Socket>* manager_; |
| 41 }; | 44 }; |
| 42 | 45 |
| 43 class SocketExtensionWithDnsLookupFunction : public SocketAsyncApiFunction { | 46 class SocketExtensionWithDnsLookupFunction : public SocketAsyncApiFunction { |
| 44 protected: | 47 protected: |
| 45 SocketExtensionWithDnsLookupFunction(); | 48 SocketExtensionWithDnsLookupFunction(); |
| 46 virtual ~SocketExtensionWithDnsLookupFunction(); | 49 virtual ~SocketExtensionWithDnsLookupFunction(); |
| 47 | 50 |
| 48 void StartDnsLookup(const std::string& hostname); | 51 void StartDnsLookup(const std::string& hostname); |
| 49 virtual void AfterDnsLookup(int lookup_result) = 0; | 52 virtual void AfterDnsLookup(int lookup_result) = 0; |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 312 |
| 310 private: | 313 private: |
| 311 void GetNetworkListOnFileThread(); | 314 void GetNetworkListOnFileThread(); |
| 312 void HandleGetNetworkListError(); | 315 void HandleGetNetworkListError(); |
| 313 void SendResponseOnUIThread(const net::NetworkInterfaceList& interface_list); | 316 void SendResponseOnUIThread(const net::NetworkInterfaceList& interface_list); |
| 314 }; | 317 }; |
| 315 | 318 |
| 316 } // namespace extensions | 319 } // namespace extensions |
| 317 | 320 |
| 318 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ | 321 #endif // CHROME_BROWSER_EXTENSIONS_API_SOCKET_SOCKET_API_H_ |
| OLD | NEW |