| 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_EXTENSION_WEB_SOCKET_PROXY_PRIVATE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_SOCKET_PROXY_PRIVATE_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_SOCKET_PROXY_PRIVATE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_SOCKET_PROXY_PRIVATE_API_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/timer.h" | 9 #include "base/timer.h" |
| 10 #include "content/common/notification_observer.h" | 10 #include "content/common/notification_observer.h" |
| 11 #include "content/common/notification_registrar.h" | 11 #include "content/common/notification_registrar.h" |
| 12 #include "chrome/browser/extensions/extension_function.h" | 12 #include "chrome/browser/extensions/extension_function.h" |
| 13 | 13 |
| 14 class WebSocketProxyPrivateGetPassportForTCPFunction | 14 class WebSocketProxyPrivateGetPassportForTCPFunction |
| 15 : public AsyncExtensionFunction, public NotificationObserver { | 15 : public AsyncExtensionFunction, public NotificationObserver { |
| 16 public: | 16 public: |
| 17 WebSocketProxyPrivateGetPassportForTCPFunction(); | 17 WebSocketProxyPrivateGetPassportForTCPFunction(); |
| 18 | 18 |
| 19 virtual ~WebSocketProxyPrivateGetPassportForTCPFunction(); | 19 virtual ~WebSocketProxyPrivateGetPassportForTCPFunction(); |
| 20 | 20 |
| 21 private: | 21 private: |
| 22 // ExtensionFunction implementation. | 22 // ExtensionFunction implementation. |
| 23 virtual bool RunImpl() OVERRIDE; | 23 virtual bool RunImpl() OVERRIDE; |
| 24 | 24 |
| 25 // NotificationObserver implementation. | 25 // NotificationObserver implementation. |
| 26 virtual void Observe( | 26 virtual void Observe( |
| 27 NotificationType type, const NotificationSource& source, | 27 int type, const NotificationSource& source, |
| 28 const NotificationDetails& details) OVERRIDE; | 28 const NotificationDetails& details) OVERRIDE; |
| 29 | 29 |
| 30 // Finalizes async operation. | 30 // Finalizes async operation. |
| 31 void Finalize(); | 31 void Finalize(); |
| 32 | 32 |
| 33 // Whether already finalized. | 33 // Whether already finalized. |
| 34 bool is_finalized_; | 34 bool is_finalized_; |
| 35 | 35 |
| 36 // Used to signal timeout (when waiting for proxy initial launch). | 36 // Used to signal timeout (when waiting for proxy initial launch). |
| 37 base::OneShotTimer<WebSocketProxyPrivateGetPassportForTCPFunction> timer_; | 37 base::OneShotTimer<WebSocketProxyPrivateGetPassportForTCPFunction> timer_; |
| 38 | 38 |
| 39 NotificationRegistrar registrar_; | 39 NotificationRegistrar registrar_; |
| 40 | 40 |
| 41 DECLARE_EXTENSION_FUNCTION_NAME("webSocketProxyPrivate.getPassportForTCP") | 41 DECLARE_EXTENSION_FUNCTION_NAME("webSocketProxyPrivate.getPassportForTCP") |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_SOCKET_PROXY_PRIVATE_API_H_ | 44 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_WEB_SOCKET_PROXY_PRIVATE_API_H_ |
| OLD | NEW |