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 16 matching lines...) Expand all Loading... | |
27 | 27 |
28 namespace remoting { | 28 namespace remoting { |
29 | 29 |
30 class ChromotingHost; | 30 class ChromotingHost; |
31 class DesktopEnvironment; | 31 class DesktopEnvironment; |
32 class MutableHostConfig; | 32 class MutableHostConfig; |
33 class RegisterSupportHostRequest; | 33 class RegisterSupportHostRequest; |
34 class SignalStrategy; | 34 class SignalStrategy; |
35 class SupportAccessVerifier; | 35 class SupportAccessVerifier; |
36 | 36 |
37 namespace policy_hack { | |
38 class NatPolicy; | |
39 } // namespace policy_hack | |
40 | |
37 // NPAPI plugin implementation for remoting host script object. | 41 // NPAPI plugin implementation for remoting host script object. |
38 // HostNPScriptObject creates threads that are required to run | 42 // HostNPScriptObject creates threads that are required to run |
39 // ChromotingHost and starts/stops the host on those threads. When | 43 // ChromotingHost and starts/stops the host on those threads. When |
40 // destroyed it sychronously shuts down the host and all threads. | 44 // destroyed it sychronously shuts down the host and all threads. |
41 class HostNPScriptObject : public HostStatusObserver { | 45 class HostNPScriptObject : public HostStatusObserver { |
42 public: | 46 public: |
43 HostNPScriptObject(NPP plugin, NPObject* parent); | 47 HostNPScriptObject(NPP plugin, NPObject* parent); |
44 virtual ~HostNPScriptObject(); | 48 virtual ~HostNPScriptObject(); |
45 | 49 |
46 bool Init(); | 50 bool Init(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
103 void OnReceivedSupportID(remoting::SupportAccessVerifier* access_verifier, | 107 void OnReceivedSupportID(remoting::SupportAccessVerifier* access_verifier, |
104 bool success, | 108 bool success, |
105 const std::string& support_id, | 109 const std::string& support_id, |
106 const base::TimeDelta& lifetime); | 110 const base::TimeDelta& lifetime); |
107 | 111 |
108 // Helper functions that run on main thread. Can be called on any | 112 // Helper functions that run on main thread. Can be called on any |
109 // other thread. | 113 // other thread. |
110 void ConnectInternal(const std::string& uid, | 114 void ConnectInternal(const std::string& uid, |
111 const std::string& auth_token, | 115 const std::string& auth_token, |
112 const std::string& auth_service); | 116 const std::string& auth_service); |
117 void ReadPolicyAndConnect(const std::string& uid, | |
118 const std::string& auth_token, | |
119 const std::string& auth_service); | |
Wez
2011/08/11 20:00:27
Can we list these methods here in the order they a
awong
2011/08/11 23:54:54
I reordered them, and renamed ConnectInternal() to
| |
113 void DisconnectInternal(); | 120 void DisconnectInternal(); |
114 | 121 |
115 // Callback for ChromotingHost::Shutdown(). | 122 // Callback for ChromotingHost::Shutdown(). |
116 void OnShutdownFinished(); | 123 void OnShutdownFinished(); |
117 | 124 |
125 // Called when the nat traversal policy is updated. | |
126 void OnNatPolicyUpdate(bool nat_traversal_enabled); | |
127 | |
118 // Helper function for executing InvokeDefault on an NPObject, and ignoring | 128 // Helper function for executing InvokeDefault on an NPObject, and ignoring |
119 // the return value. | 129 // the return value. |
120 bool InvokeAndIgnoreResult(NPObject* func, | 130 bool InvokeAndIgnoreResult(NPObject* func, |
121 const NPVariant* args, | 131 const NPVariant* args, |
122 uint32_t argCount); | 132 uint32_t argCount); |
123 | 133 |
124 // Posts a task on the main NP thread. | 134 // Posts a task on the main NP thread. |
125 void PostTaskToNPThread( | 135 void PostTaskToNPThread( |
126 const tracked_objects::Location& from_here, const base::Closure& task); | 136 const tracked_objects::Location& from_here, const base::Closure& task); |
127 | 137 |
(...skipping 16 matching lines...) Expand all Loading... | |
144 scoped_ptr<RegisterSupportHostRequest> register_request_; | 154 scoped_ptr<RegisterSupportHostRequest> register_request_; |
145 scoped_refptr<MutableHostConfig> host_config_; | 155 scoped_refptr<MutableHostConfig> host_config_; |
146 ChromotingHostContext host_context_; | 156 ChromotingHostContext host_context_; |
147 scoped_ptr<DesktopEnvironment> desktop_environment_; | 157 scoped_ptr<DesktopEnvironment> desktop_environment_; |
148 | 158 |
149 scoped_refptr<ChromotingHost> host_; | 159 scoped_refptr<ChromotingHost> host_; |
150 int failed_login_attempts_; | 160 int failed_login_attempts_; |
151 | 161 |
152 base::WaitableEvent disconnected_event_; | 162 base::WaitableEvent disconnected_event_; |
153 base::CancellationFlag destructing_; | 163 base::CancellationFlag destructing_; |
164 | |
165 // Ensure this object is not watching before deleting. | |
dmac
2011/08/11 18:42:55
This comment confuses me a bit. Are you asking the
awong
2011/08/11 19:04:07
Moved comment into nat_policy.h where it belongs.
| |
166 scoped_ptr<policy_hack::NatPolicy> nat_policy_; | |
167 | |
168 bool nat_traversal_enabled_; | |
169 bool policy_received_; | |
dmac
2011/08/11 18:42:55
could we add quick comments on these (especially t
awong
2011/08/11 19:04:07
Added (non-quick) comments.
| |
170 base::Closure pending_connect_; | |
154 }; | 171 }; |
155 | 172 |
156 } // namespace remoting | 173 } // namespace remoting |
157 | 174 |
158 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::HostNPScriptObject); | 175 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::HostNPScriptObject); |
159 | 176 |
160 #endif // REMOTING_HOST_HOST_SCRIPT_OBJECT_H_ | 177 #endif // REMOTING_HOST_HOST_SCRIPT_OBJECT_H_ |
OLD | NEW |