| 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 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/synchronization/cancellation_flag.h" | 14 #include "base/synchronization/cancellation_flag.h" |
| 15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 16 #include "base/synchronization/waitable_event.h" | 16 #include "base/synchronization/waitable_event.h" |
| 17 #include "base/string16.h" | 17 #include "base/string16.h" |
| 18 #include "base/threading/platform_thread.h" | 18 #include "base/threading/platform_thread.h" |
| 19 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
| 20 #include "base/time.h" | 20 #include "base/time.h" |
| 21 #include "remoting/base/plugin_message_loop_proxy.h" | 21 #include "remoting/base/plugin_thread_task_runner.h" |
| 22 #include "remoting/host/chromoting_host_context.h" | 22 #include "remoting/host/chromoting_host_context.h" |
| 23 #include "remoting/host/host_key_pair.h" | 23 #include "remoting/host/host_key_pair.h" |
| 24 #include "remoting/host/host_status_observer.h" | 24 #include "remoting/host/host_status_observer.h" |
| 25 #include "remoting/host/log_to_server.h" | 25 #include "remoting/host/log_to_server.h" |
| 26 #include "remoting/host/plugin/daemon_controller.h" | 26 #include "remoting/host/plugin/daemon_controller.h" |
| 27 #include "remoting/host/plugin/host_plugin_utils.h" | 27 #include "remoting/host/plugin/host_plugin_utils.h" |
| 28 #include "remoting/host/ui_strings.h" | 28 #include "remoting/host/ui_strings.h" |
| 29 #include "third_party/npapi/bindings/npapi.h" | 29 #include "third_party/npapi/bindings/npapi.h" |
| 30 #include "third_party/npapi/bindings/npfunctions.h" | 30 #include "third_party/npapi/bindings/npfunctions.h" |
| 31 #include "third_party/npapi/bindings/npruntime.h" | 31 #include "third_party/npapi/bindings/npruntime.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 44 class PolicyWatcher; | 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 PluginThreadTaskRunner::Delegate* plugin_thread_delegate); |
| 55 virtual ~HostNPScriptObject(); | 55 virtual ~HostNPScriptObject(); |
| 56 | 56 |
| 57 bool Init(); | 57 bool Init(); |
| 58 | 58 |
| 59 bool HasMethod(const std::string& method_name); | 59 bool HasMethod(const std::string& method_name); |
| 60 bool InvokeDefault(const NPVariant* args, | 60 bool InvokeDefault(const NPVariant* args, |
| 61 uint32_t arg_count, | 61 uint32_t arg_count, |
| 62 NPVariant* result); | 62 NPVariant* result); |
| 63 bool Invoke(const std::string& method_name, | 63 bool Invoke(const std::string& method_name, |
| 64 const NPVariant* args, | 64 const NPVariant* args, |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 | 295 |
| 296 base::Lock access_code_lock_; | 296 base::Lock access_code_lock_; |
| 297 std::string access_code_; | 297 std::string access_code_; |
| 298 base::TimeDelta access_code_lifetime_; | 298 base::TimeDelta access_code_lifetime_; |
| 299 | 299 |
| 300 std::string client_username_; | 300 std::string client_username_; |
| 301 ScopedRefNPObject log_debug_info_func_; | 301 ScopedRefNPObject log_debug_info_func_; |
| 302 ScopedRefNPObject on_nat_traversal_policy_changed_func_; | 302 ScopedRefNPObject on_nat_traversal_policy_changed_func_; |
| 303 ScopedRefNPObject on_state_changed_func_; | 303 ScopedRefNPObject on_state_changed_func_; |
| 304 base::PlatformThreadId np_thread_id_; | 304 base::PlatformThreadId np_thread_id_; |
| 305 scoped_refptr<PluginMessageLoopProxy> plugin_task_runner_; | 305 scoped_refptr<PluginThreadTaskRunner> plugin_task_runner_; |
| 306 | 306 |
| 307 scoped_ptr<ChromotingHostContext> host_context_; | 307 scoped_ptr<ChromotingHostContext> host_context_; |
| 308 HostKeyPair host_key_pair_; | 308 HostKeyPair host_key_pair_; |
| 309 scoped_ptr<SignalStrategy> signal_strategy_; | 309 scoped_ptr<SignalStrategy> signal_strategy_; |
| 310 scoped_ptr<RegisterSupportHostRequest> register_request_; | 310 scoped_ptr<RegisterSupportHostRequest> register_request_; |
| 311 scoped_ptr<LogToServer> log_to_server_; | 311 scoped_ptr<LogToServer> log_to_server_; |
| 312 scoped_ptr<DesktopEnvironment> desktop_environment_; | 312 scoped_ptr<DesktopEnvironment> desktop_environment_; |
| 313 scoped_ptr<It2MeHostUserInterface> it2me_host_user_interface_; | 313 scoped_ptr<It2MeHostUserInterface> it2me_host_user_interface_; |
| 314 | 314 |
| 315 scoped_refptr<ChromotingHost> host_; | 315 scoped_refptr<ChromotingHost> host_; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 346 // SequencedWorkerPool. Problem is that SequencedWorkerPool relies | 346 // SequencedWorkerPool. Problem is that SequencedWorkerPool relies |
| 347 // on MessageLoopProxy::current(). | 347 // on MessageLoopProxy::current(). |
| 348 base::Thread worker_thread_; | 348 base::Thread worker_thread_; |
| 349 | 349 |
| 350 DISALLOW_COPY_AND_ASSIGN(HostNPScriptObject); | 350 DISALLOW_COPY_AND_ASSIGN(HostNPScriptObject); |
| 351 }; | 351 }; |
| 352 | 352 |
| 353 } // namespace remoting | 353 } // namespace remoting |
| 354 | 354 |
| 355 #endif // REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ | 355 #endif // REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ |
| OLD | NEW |