Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: remoting/host/plugin/host_script_object.h

Issue 7599017: Framework to allow Chromoting host to respect NAT traversal policy in linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with Sergey's MessageLoopProxy change Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/DEPS ('k') | remoting/host/plugin/host_script_object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 void LogDebugInfo(const std::string& message); 104 void LogDebugInfo(const std::string& message);
101 105
102 // Callbacks invoked during session setup. 106 // Callbacks invoked during session setup.
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 ReadPolicyAndConnect(const std::string& uid,
115 const std::string& auth_token,
116 const std::string& auth_service);
117 void FinishConnect(const std::string& uid,
111 const std::string& auth_token, 118 const std::string& auth_token,
112 const std::string& auth_service); 119 const std::string& auth_service);
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
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 scoped_ptr<policy_hack::NatPolicy> nat_policy_;
166
167 // Host the current nat traversal policy setting.
168 bool nat_traversal_enabled_;
169
170 // Indiciates whether or not a policy has ever been read. This is to ensure
171 // that on startup, we do not accidentally start a connection before we have
172 // queried our policy restrictions.
173 bool policy_received_;
174
175 // On startup, it is possible to have Connect() called before the policy read
176 // is completed. Rather than just failing, we thunk the connection call so
177 // it can be executed after at least one successful policy read. This
178 // variable contains the thunk if it is necessary.
179 base::Closure pending_connect_;
154 }; 180 };
155 181
156 } // namespace remoting 182 } // namespace remoting
157 183
158 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::HostNPScriptObject); 184 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::HostNPScriptObject);
159 185
160 #endif // REMOTING_HOST_HOST_SCRIPT_OBJECT_H_ 186 #endif // REMOTING_HOST_HOST_SCRIPT_OBJECT_H_
OLDNEW
« no previous file with comments | « remoting/DEPS ('k') | remoting/host/plugin/host_script_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698