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 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 23 matching lines...) Expand all Loading... |
34 | 34 |
35 class ChromotingHost; | 35 class ChromotingHost; |
36 class DesktopEnvironment; | 36 class DesktopEnvironment; |
37 class It2MeHostUserInterface; | 37 class It2MeHostUserInterface; |
38 class MutableHostConfig; | 38 class MutableHostConfig; |
39 class RegisterSupportHostRequest; | 39 class RegisterSupportHostRequest; |
40 class SignalStrategy; | 40 class SignalStrategy; |
41 class SupportAccessVerifier; | 41 class SupportAccessVerifier; |
42 | 42 |
43 namespace policy_hack { | 43 namespace policy_hack { |
44 class NatPolicy; | 44 class PolicyWatcher; |
45 } // namespace policy_hack | 45 } // namespace policy_hack |
46 | 46 |
47 // NPAPI plugin implementation for remoting host script object. | 47 // NPAPI plugin implementation for remoting host script object. |
48 // HostNPScriptObject creates threads that are required to run | 48 // HostNPScriptObject creates threads that are required to run |
49 // ChromotingHost and starts/stops the host on those threads. When | 49 // ChromotingHost and starts/stops the host on those threads. When |
50 // destroyed it sychronously shuts down the host and all threads. | 50 // destroyed it sychronously shuts down the host and all threads. |
51 class HostNPScriptObject : public HostStatusObserver { | 51 class HostNPScriptObject : public HostStatusObserver { |
52 public: | 52 public: |
53 HostNPScriptObject(NPP plugin, NPObject* parent, | 53 HostNPScriptObject(NPP plugin, NPObject* parent, |
54 PluginMessageLoopProxy::Delegate* plugin_thread_delegate); | 54 PluginMessageLoopProxy::Delegate* plugin_thread_delegate); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 const std::string& auth_token, | 201 const std::string& auth_token, |
202 const std::string& auth_service); | 202 const std::string& auth_service); |
203 void FinishConnectNetworkThread(const std::string& uid, | 203 void FinishConnectNetworkThread(const std::string& uid, |
204 const std::string& auth_token, | 204 const std::string& auth_token, |
205 const std::string& auth_service); | 205 const std::string& auth_service); |
206 void DisconnectInternal(); | 206 void DisconnectInternal(); |
207 | 207 |
208 // Callback for ChromotingHost::Shutdown(). | 208 // Callback for ChromotingHost::Shutdown(). |
209 void OnShutdownFinished(); | 209 void OnShutdownFinished(); |
210 | 210 |
| 211 // Called when a policy is updated. |
| 212 void OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies); |
| 213 |
211 // Called when the nat traversal policy is updated. | 214 // Called when the nat traversal policy is updated. |
212 void OnNatPolicyUpdate(bool nat_traversal_enabled); | 215 void OnNatPolicyUpdate(bool nat_traversal_enabled); |
213 | 216 |
214 void LocalizeStrings(NPObject* localize_func); | 217 void LocalizeStrings(NPObject* localize_func); |
215 | 218 |
216 // Helper function for executing InvokeDefault on an NPObject that performs | 219 // Helper function for executing InvokeDefault on an NPObject that performs |
217 // a string->string mapping with one optional substitution parameter. Stores | 220 // a string->string mapping with one optional substitution parameter. Stores |
218 // the translation in |result| and returns true on success, or leaves it | 221 // the translation in |result| and returns true on success, or leaves it |
219 // unchanged and returns false on failure. | 222 // unchanged and returns false on failure. |
220 bool LocalizeString(NPObject* localize_func, const char* tag, | 223 bool LocalizeString(NPObject* localize_func, const char* tag, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 scoped_refptr<ChromotingHost> host_; | 306 scoped_refptr<ChromotingHost> host_; |
304 int failed_login_attempts_; | 307 int failed_login_attempts_; |
305 | 308 |
306 UiStrings ui_strings_; | 309 UiStrings ui_strings_; |
307 base::Lock ui_strings_lock_; | 310 base::Lock ui_strings_lock_; |
308 | 311 |
309 base::WaitableEvent disconnected_event_; | 312 base::WaitableEvent disconnected_event_; |
310 | 313 |
311 base::Lock nat_policy_lock_; | 314 base::Lock nat_policy_lock_; |
312 | 315 |
313 scoped_ptr<policy_hack::NatPolicy> nat_policy_; | 316 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; |
314 | 317 |
315 // Host the current nat traversal policy setting. | 318 // Host the current nat traversal policy setting. |
316 bool nat_traversal_enabled_; | 319 bool nat_traversal_enabled_; |
317 | 320 |
318 // Indicates whether or not a policy has ever been read. This is to ensure | 321 // Indicates whether or not a policy has ever been read. This is to ensure |
319 // that on startup, we do not accidentally start a connection before we have | 322 // that on startup, we do not accidentally start a connection before we have |
320 // queried our policy restrictions. | 323 // queried our policy restrictions. |
321 bool policy_received_; | 324 bool policy_received_; |
322 | 325 |
323 // On startup, it is possible to have Connect() called before the policy read | 326 // On startup, it is possible to have Connect() called before the policy read |
(...skipping 10 matching lines...) Expand all Loading... |
334 // SequencedWorkerPool. Problem is that SequencedWorkerPool relies | 337 // SequencedWorkerPool. Problem is that SequencedWorkerPool relies |
335 // on MessageLoopProxy::current(). | 338 // on MessageLoopProxy::current(). |
336 base::Thread worker_thread_; | 339 base::Thread worker_thread_; |
337 | 340 |
338 DISALLOW_COPY_AND_ASSIGN(HostNPScriptObject); | 341 DISALLOW_COPY_AND_ASSIGN(HostNPScriptObject); |
339 }; | 342 }; |
340 | 343 |
341 } // namespace remoting | 344 } // namespace remoting |
342 | 345 |
343 #endif // REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ | 346 #endif // REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ |
OLD | NEW |