| 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 REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ | 5 #ifndef REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ |
| 6 #define REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ | 6 #define REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 virtual void OnSignallingConnected(remoting::SignalStrategy* signal_strategy, | 73 virtual void OnSignallingConnected(remoting::SignalStrategy* signal_strategy, |
| 74 const std::string& full_jid) OVERRIDE; | 74 const std::string& full_jid) OVERRIDE; |
| 75 virtual void OnSignallingDisconnected() OVERRIDE; | 75 virtual void OnSignallingDisconnected() OVERRIDE; |
| 76 virtual void OnAccessDenied() OVERRIDE; | 76 virtual void OnAccessDenied() OVERRIDE; |
| 77 virtual void OnClientAuthenticated( | 77 virtual void OnClientAuthenticated( |
| 78 remoting::protocol::ConnectionToClient* client) OVERRIDE; | 78 remoting::protocol::ConnectionToClient* client) OVERRIDE; |
| 79 virtual void OnClientDisconnected( | 79 virtual void OnClientDisconnected( |
| 80 remoting::protocol::ConnectionToClient* client) OVERRIDE; | 80 remoting::protocol::ConnectionToClient* client) OVERRIDE; |
| 81 virtual void OnShutdown() OVERRIDE; | 81 virtual void OnShutdown() OVERRIDE; |
| 82 | 82 |
| 83 // A Log Message Handler that is called after each LOG message has been | 83 // Post LogDebugInfo to the correct proxy (and thus, on the correct thread). |
| 84 // processed. This must be of type LogMessageHandlerFunction defined in | 84 // This should only be called by HostLogHandler. To log to the UI, use the |
| 85 // base/logging.h. | 85 // standard LOG(INFO) and it will be sent to this method. |
| 86 static bool LogToUI(int severity, const char* file, int line, | 86 void PostLogDebugInfo(const std::string& message); |
| 87 size_t message_start, const std::string& str); | |
| 88 | 87 |
| 89 private: | 88 private: |
| 90 enum State { | 89 enum State { |
| 91 kDisconnected, | 90 kDisconnected, |
| 92 kRequestedAccessCode, | 91 kRequestedAccessCode, |
| 93 kReceivedAccessCode, | 92 kReceivedAccessCode, |
| 94 kConnected, | 93 kConnected, |
| 95 kAffirmingConnection, | 94 kAffirmingConnection, |
| 96 kError | 95 kError |
| 97 }; | 96 }; |
| 98 | 97 |
| 99 // Start connection. args are: | 98 // Start connection. args are: |
| 100 // string uid, string auth_token | 99 // string uid, string auth_token |
| 101 // No result. | 100 // No result. |
| 102 bool Connect(const NPVariant* args, uint32_t argCount, NPVariant* result); | 101 bool Connect(const NPVariant* args, uint32_t argCount, NPVariant* result); |
| 103 | 102 |
| 104 // Disconnect. No arguments or result. | 103 // Disconnect. No arguments or result. |
| 105 bool Disconnect(const NPVariant* args, uint32_t argCount, NPVariant* result); | 104 bool Disconnect(const NPVariant* args, uint32_t argCount, NPVariant* result); |
| 106 | 105 |
| 107 // Localize strings. args are: | 106 // Localize strings. args are: |
| 108 // localize_func - a callback function which returns a localized string for | 107 // localize_func - a callback function which returns a localized string for |
| 109 // a given tag name. | 108 // a given tag name. |
| 110 // No result. | 109 // No result. |
| 111 bool Localize(const NPVariant* args, uint32_t argCount, NPVariant* result); | 110 bool Localize(const NPVariant* args, uint32_t argCount, NPVariant* result); |
| 112 | 111 |
| 113 // Call OnStateChanged handler if there is one. | 112 // Call OnStateChanged handler if there is one. |
| 114 void OnStateChanged(State state); | 113 void OnStateChanged(State state); |
| 115 | 114 |
| 116 // Call LogDebugInfo handler if there is one. | 115 // Call LogDebugInfo handler if there is one. |
| 116 // This must be called on the correct thread. |
| 117 void LogDebugInfo(const std::string& message); | 117 void LogDebugInfo(const std::string& message); |
| 118 | 118 |
| 119 // Callbacks invoked during session setup. | 119 // Callbacks invoked during session setup. |
| 120 void OnReceivedSupportID(remoting::SupportAccessVerifier* access_verifier, | 120 void OnReceivedSupportID(remoting::SupportAccessVerifier* access_verifier, |
| 121 bool success, | 121 bool success, |
| 122 const std::string& support_id, | 122 const std::string& support_id, |
| 123 const base::TimeDelta& lifetime); | 123 const base::TimeDelta& lifetime); |
| 124 | 124 |
| 125 // Helper functions that run on main thread. Can be called on any | 125 // Helper functions that run on main thread. Can be called on any |
| 126 // other thread. | 126 // other thread. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // is completed. Rather than just failing, we thunk the connection call so | 194 // is completed. Rather than just failing, we thunk the connection call so |
| 195 // it can be executed after at least one successful policy read. This | 195 // it can be executed after at least one successful policy read. This |
| 196 // variable contains the thunk if it is necessary. | 196 // variable contains the thunk if it is necessary. |
| 197 base::Closure pending_connect_; | 197 base::Closure pending_connect_; |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 } // namespace remoting | 200 } // namespace remoting |
| 201 | 201 |
| 202 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::HostNPScriptObject); | 202 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::HostNPScriptObject); |
| 203 | 203 |
| 204 #endif // REMOTING_HOST_HOST_SCRIPT_OBJECT_H_ | 204 #endif // REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ |
| OLD | NEW |