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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 virtual void OnSignallingConnected(remoting::SignalStrategy* signal_strategy, | 71 virtual void OnSignallingConnected(remoting::SignalStrategy* signal_strategy, |
72 const std::string& full_jid) OVERRIDE; | 72 const std::string& full_jid) OVERRIDE; |
73 virtual void OnSignallingDisconnected() OVERRIDE; | 73 virtual void OnSignallingDisconnected() OVERRIDE; |
74 virtual void OnAccessDenied() OVERRIDE; | 74 virtual void OnAccessDenied() OVERRIDE; |
75 virtual void OnClientAuthenticated( | 75 virtual void OnClientAuthenticated( |
76 remoting::protocol::ConnectionToClient* client) OVERRIDE; | 76 remoting::protocol::ConnectionToClient* client) OVERRIDE; |
77 virtual void OnClientDisconnected( | 77 virtual void OnClientDisconnected( |
78 remoting::protocol::ConnectionToClient* client) OVERRIDE; | 78 remoting::protocol::ConnectionToClient* client) OVERRIDE; |
79 virtual void OnShutdown() OVERRIDE; | 79 virtual void OnShutdown() OVERRIDE; |
80 | 80 |
81 // A Log Message Handler that is called after each LOG message has been | 81 // Post LogDebugInfo to the correct proxy (and thus, on the correct thread). |
82 // processed. This must be of type LogMessageHandlerFunction defined in | 82 // This should only be called by HostLogHandler. To log to the UI, use the |
83 // base/logging.h. | 83 // standard LOG(INFO) and it will be sent to this method. |
84 static bool LogToUI(int severity, const char* file, int line, | 84 void PostLogDebugInfo(const std::string& message); |
85 size_t message_start, const std::string& str); | |
86 | 85 |
87 private: | 86 private: |
88 enum State { | 87 enum State { |
89 kDisconnected, | 88 kDisconnected, |
90 kRequestedAccessCode, | 89 kRequestedAccessCode, |
91 kReceivedAccessCode, | 90 kReceivedAccessCode, |
92 kConnected, | 91 kConnected, |
93 kAffirmingConnection, | 92 kAffirmingConnection, |
94 kError | 93 kError |
95 }; | 94 }; |
96 | 95 |
97 // Start connection. args are: | 96 // Start connection. args are: |
98 // string uid, string auth_token | 97 // string uid, string auth_token |
99 // No result. | 98 // No result. |
100 bool Connect(const NPVariant* args, uint32_t argCount, NPVariant* result); | 99 bool Connect(const NPVariant* args, uint32_t argCount, NPVariant* result); |
101 | 100 |
102 // Disconnect. No arguments or result. | 101 // Disconnect. No arguments or result. |
103 bool Disconnect(const NPVariant* args, uint32_t argCount, NPVariant* result); | 102 bool Disconnect(const NPVariant* args, uint32_t argCount, NPVariant* result); |
104 | 103 |
105 // Call OnStateChanged handler if there is one. | 104 // Call OnStateChanged handler if there is one. |
106 void OnStateChanged(State state); | 105 void OnStateChanged(State state); |
107 | 106 |
108 // Call LogDebugInfo handler if there is one. | 107 // Call LogDebugInfo handler if there is one. |
108 // This assumes that it's being called on the correct thread. | |
Wez
2011/08/30 05:20:02
nit: "assumes that...called" -> "must be called".
garykac
2011/08/31 00:59:00
Done.
| |
109 void LogDebugInfo(const std::string& message); | 109 void LogDebugInfo(const std::string& message); |
110 | 110 |
111 // Callbacks invoked during session setup. | 111 // Callbacks invoked during session setup. |
112 void OnReceivedSupportID(remoting::SupportAccessVerifier* access_verifier, | 112 void OnReceivedSupportID(remoting::SupportAccessVerifier* access_verifier, |
113 bool success, | 113 bool success, |
114 const std::string& support_id, | 114 const std::string& support_id, |
115 const base::TimeDelta& lifetime); | 115 const base::TimeDelta& lifetime); |
116 | 116 |
117 // Helper functions that run on main thread. Can be called on any | 117 // Helper functions that run on main thread. Can be called on any |
118 // other thread. | 118 // other thread. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 // is completed. Rather than just failing, we thunk the connection call so | 183 // is completed. Rather than just failing, we thunk the connection call so |
184 // it can be executed after at least one successful policy read. This | 184 // it can be executed after at least one successful policy read. This |
185 // variable contains the thunk if it is necessary. | 185 // variable contains the thunk if it is necessary. |
186 base::Closure pending_connect_; | 186 base::Closure pending_connect_; |
187 }; | 187 }; |
188 | 188 |
189 } // namespace remoting | 189 } // namespace remoting |
190 | 190 |
191 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::HostNPScriptObject); | 191 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::HostNPScriptObject); |
192 | 192 |
193 #endif // REMOTING_HOST_HOST_SCRIPT_OBJECT_H_ | 193 #endif // REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ |
OLD | NEW |