| 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 |
| 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/waitable_event.h" | 16 #include "base/synchronization/waitable_event.h" |
| 16 #include "base/string16.h" | 17 #include "base/string16.h" |
| 17 #include "base/threading/platform_thread.h" | 18 #include "base/threading/platform_thread.h" |
| 18 #include "base/time.h" | 19 #include "base/time.h" |
| 19 #include "remoting/base/plugin_message_loop_proxy.h" | 20 #include "remoting/base/plugin_message_loop_proxy.h" |
| 20 #include "remoting/host/chromoting_host_context.h" | 21 #include "remoting/host/chromoting_host_context.h" |
| 21 #include "remoting/host/host_status_observer.h" | 22 #include "remoting/host/host_status_observer.h" |
| 22 #include "remoting/host/plugin/host_plugin_utils.h" | 23 #include "remoting/host/plugin/host_plugin_utils.h" |
| 24 #include "remoting/host/ui_strings.h" |
| 23 #include "third_party/npapi/bindings/npapi.h" | 25 #include "third_party/npapi/bindings/npapi.h" |
| 24 #include "third_party/npapi/bindings/npfunctions.h" | 26 #include "third_party/npapi/bindings/npfunctions.h" |
| 25 #include "third_party/npapi/bindings/npruntime.h" | 27 #include "third_party/npapi/bindings/npruntime.h" |
| 26 | 28 |
| 27 namespace tracked_objects { | 29 namespace tracked_objects { |
| 28 class Location; | 30 class Location; |
| 29 } // namespace tracked_objects | 31 } // namespace tracked_objects |
| 30 | 32 |
| 31 namespace remoting { | 33 namespace remoting { |
| 32 | 34 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 }; | 97 }; |
| 96 | 98 |
| 97 // Start connection. args are: | 99 // Start connection. args are: |
| 98 // string uid, string auth_token | 100 // string uid, string auth_token |
| 99 // No result. | 101 // No result. |
| 100 bool Connect(const NPVariant* args, uint32_t argCount, NPVariant* result); | 102 bool Connect(const NPVariant* args, uint32_t argCount, NPVariant* result); |
| 101 | 103 |
| 102 // Disconnect. No arguments or result. | 104 // Disconnect. No arguments or result. |
| 103 bool Disconnect(const NPVariant* args, uint32_t argCount, NPVariant* result); | 105 bool Disconnect(const NPVariant* args, uint32_t argCount, NPVariant* result); |
| 104 | 106 |
| 107 // Localize strings. args are: |
| 108 // localize_func - a callback function which returns a localized string for |
| 109 // a given tag name. |
| 110 // No result. |
| 111 bool Localize(const NPVariant* args, uint32_t argCount, NPVariant* result); |
| 112 |
| 105 // Call OnStateChanged handler if there is one. | 113 // Call OnStateChanged handler if there is one. |
| 106 void OnStateChanged(State state); | 114 void OnStateChanged(State state); |
| 107 | 115 |
| 108 // Call LogDebugInfo handler if there is one. | 116 // Call LogDebugInfo handler if there is one. |
| 109 void LogDebugInfo(const std::string& message); | 117 void LogDebugInfo(const std::string& message); |
| 110 | 118 |
| 111 // Callbacks invoked during session setup. | 119 // Callbacks invoked during session setup. |
| 112 void OnReceivedSupportID(remoting::SupportAccessVerifier* access_verifier, | 120 void OnReceivedSupportID(remoting::SupportAccessVerifier* access_verifier, |
| 113 bool success, | 121 bool success, |
| 114 const std::string& support_id, | 122 const std::string& support_id, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 scoped_refptr<PluginMessageLoopProxy> plugin_message_loop_proxy_; | 168 scoped_refptr<PluginMessageLoopProxy> plugin_message_loop_proxy_; |
| 161 | 169 |
| 162 scoped_ptr<RegisterSupportHostRequest> register_request_; | 170 scoped_ptr<RegisterSupportHostRequest> register_request_; |
| 163 scoped_refptr<MutableHostConfig> host_config_; | 171 scoped_refptr<MutableHostConfig> host_config_; |
| 164 ChromotingHostContext host_context_; | 172 ChromotingHostContext host_context_; |
| 165 scoped_ptr<DesktopEnvironment> desktop_environment_; | 173 scoped_ptr<DesktopEnvironment> desktop_environment_; |
| 166 | 174 |
| 167 scoped_refptr<ChromotingHost> host_; | 175 scoped_refptr<ChromotingHost> host_; |
| 168 int failed_login_attempts_; | 176 int failed_login_attempts_; |
| 169 | 177 |
| 178 UiStrings ui_strings_; |
| 179 base::Lock ui_strings_lock_; |
| 180 |
| 170 base::WaitableEvent disconnected_event_; | 181 base::WaitableEvent disconnected_event_; |
| 171 | 182 |
| 172 scoped_ptr<policy_hack::NatPolicy> nat_policy_; | 183 scoped_ptr<policy_hack::NatPolicy> nat_policy_; |
| 173 | 184 |
| 174 // Host the current nat traversal policy setting. | 185 // Host the current nat traversal policy setting. |
| 175 bool nat_traversal_enabled_; | 186 bool nat_traversal_enabled_; |
| 176 | 187 |
| 177 // Indiciates whether or not a policy has ever been read. This is to ensure | 188 // Indiciates whether or not a policy has ever been read. This is to ensure |
| 178 // that on startup, we do not accidentally start a connection before we have | 189 // that on startup, we do not accidentally start a connection before we have |
| 179 // queried our policy restrictions. | 190 // queried our policy restrictions. |
| 180 bool policy_received_; | 191 bool policy_received_; |
| 181 | 192 |
| 182 // On startup, it is possible to have Connect() called before the policy read | 193 // On startup, it is possible to have Connect() called before the policy read |
| 183 // 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 |
| 184 // 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 |
| 185 // variable contains the thunk if it is necessary. | 196 // variable contains the thunk if it is necessary. |
| 186 base::Closure pending_connect_; | 197 base::Closure pending_connect_; |
| 187 }; | 198 }; |
| 188 | 199 |
| 189 } // namespace remoting | 200 } // namespace remoting |
| 190 | 201 |
| 191 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::HostNPScriptObject); | 202 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::HostNPScriptObject); |
| 192 | 203 |
| 193 #endif // REMOTING_HOST_HOST_SCRIPT_OBJECT_H_ | 204 #endif // REMOTING_HOST_HOST_SCRIPT_OBJECT_H_ |
| OLD | NEW |