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

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

Issue 10823083: [Chromoting] Implement the host domain policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync. Created 8 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
OLDNEW
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 30 matching lines...) Expand all
41 class SignalStrategy; 41 class SignalStrategy;
42 class SupportAccessVerifier; 42 class SupportAccessVerifier;
43 43
44 namespace policy_hack { 44 namespace policy_hack {
45 class PolicyWatcher; 45 class PolicyWatcher;
46 } // namespace policy_hack 46 } // namespace policy_hack
47 47
48 // NPAPI plugin implementation for remoting host script object. 48 // NPAPI plugin implementation for remoting host script object.
49 // HostNPScriptObject creates threads that are required to run 49 // HostNPScriptObject creates threads that are required to run
50 // ChromotingHost and starts/stops the host on those threads. When 50 // ChromotingHost and starts/stops the host on those threads. When
51 // destroyed it sychronously shuts down the host and all threads. 51 // destroyed it synchronously shuts down the host and all threads.
52 class HostNPScriptObject : public HostStatusObserver { 52 class HostNPScriptObject : public HostStatusObserver {
53 public: 53 public:
54 HostNPScriptObject(NPP plugin, NPObject* parent, 54 HostNPScriptObject(NPP plugin, NPObject* parent,
55 PluginThreadTaskRunner::Delegate* plugin_thread_delegate); 55 PluginThreadTaskRunner::Delegate* plugin_thread_delegate);
56 virtual ~HostNPScriptObject(); 56 virtual ~HostNPScriptObject();
57 57
58 bool Init(); 58 bool Init();
59 59
60 bool HasMethod(const std::string& method_name); 60 bool HasMethod(const std::string& method_name);
61 bool InvokeDefault(const NPVariant* args, 61 bool InvokeDefault(const NPVariant* args,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 const std::string& auth_service); 206 const std::string& auth_service);
207 void DisconnectInternal(); 207 void DisconnectInternal();
208 208
209 // Callback for ChromotingHost::Shutdown(). 209 // Callback for ChromotingHost::Shutdown().
210 void OnShutdownFinished(); 210 void OnShutdownFinished();
211 211
212 // Called when a policy is updated. 212 // Called when a policy is updated.
213 void OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies); 213 void OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies);
214 214
215 // Called when the nat traversal policy is updated. 215 // Called when the nat traversal policy is updated.
216 void OnNatPolicyUpdate(bool nat_traversal_enabled); 216 void UpdateNatPolicy(bool nat_traversal_enabled);
217
218 // Called when the host domain policy is updated.
219 void UpdateHostDomainPolicy(const std::string& host_domain);
217 220
218 void LocalizeStrings(NPObject* localize_func); 221 void LocalizeStrings(NPObject* localize_func);
219 222
220 // Helper function for executing InvokeDefault on an NPObject that performs 223 // Helper function for executing InvokeDefault on an NPObject that performs
221 // a string->string mapping without substitution. Stores the translation in 224 // a string->string mapping without substitution. Stores the translation in
222 // |result| and returns true on success, or leaves it unchanged and returns 225 // |result| and returns true on success, or leaves it unchanged and returns
223 // false on failure. 226 // false on failure.
224 bool LocalizeString(NPObject* localize_func, const char* tag, 227 bool LocalizeString(NPObject* localize_func, const char* tag,
225 string16* result); 228 string16* result);
226 229
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 325
323 base::WaitableEvent disconnected_event_; 326 base::WaitableEvent disconnected_event_;
324 327
325 base::Lock nat_policy_lock_; 328 base::Lock nat_policy_lock_;
326 329
327 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; 330 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_;
328 331
329 // Host the current nat traversal policy setting. 332 // Host the current nat traversal policy setting.
330 bool nat_traversal_enabled_; 333 bool nat_traversal_enabled_;
331 334
335 // The host domain policy setting.
336 std::string required_host_domain_;
337
332 // Indicates whether or not a policy has ever been read. This is to ensure 338 // Indicates whether or not a policy has ever been read. This is to ensure
333 // that on startup, we do not accidentally start a connection before we have 339 // that on startup, we do not accidentally start a connection before we have
334 // queried our policy restrictions. 340 // queried our policy restrictions.
335 bool policy_received_; 341 bool policy_received_;
336 342
337 // On startup, it is possible to have Connect() called before the policy read 343 // On startup, it is possible to have Connect() called before the policy read
338 // is completed. Rather than just failing, we thunk the connection call so 344 // is completed. Rather than just failing, we thunk the connection call so
339 // it can be executed after at least one successful policy read. This 345 // it can be executed after at least one successful policy read. This
340 // variable contains the thunk if it is necessary. 346 // variable contains the thunk if it is necessary.
341 base::Closure pending_connect_; 347 base::Closure pending_connect_;
342 348
343 ////////////////////////////////////////////////////////// 349 //////////////////////////////////////////////////////////
344 // Me2Me host state. 350 // Me2Me host state.
345 scoped_ptr<DaemonController> daemon_controller_; 351 scoped_ptr<DaemonController> daemon_controller_;
346 352
347 // TODO(sergeyu): Replace this thread with 353 // TODO(sergeyu): Replace this thread with
348 // SequencedWorkerPool. Problem is that SequencedWorkerPool relies 354 // SequencedWorkerPool. Problem is that SequencedWorkerPool relies
349 // on MessageLoopProxy::current(). 355 // on MessageLoopProxy::current().
350 base::Thread worker_thread_; 356 base::Thread worker_thread_;
351 357
352 DISALLOW_COPY_AND_ASSIGN(HostNPScriptObject); 358 DISALLOW_COPY_AND_ASSIGN(HostNPScriptObject);
353 }; 359 };
354 360
355 } // namespace remoting 361 } // namespace remoting
356 362
357 #endif // REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ 363 #endif // REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698