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

Side by Side Diff: remoting/host/it2me/it2me_host.cc

Issue 722743003: Reporting of policy errors via host-offline-reason: part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "remoting/host/it2me/it2me_host.h" 5 #include "remoting/host/it2me/it2me_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 desktop_environment_factory_.reset(new It2MeDesktopEnvironmentFactory( 64 desktop_environment_factory_.reset(new It2MeDesktopEnvironmentFactory(
65 host_context_->network_task_runner(), 65 host_context_->network_task_runner(),
66 host_context_->input_task_runner(), 66 host_context_->input_task_runner(),
67 host_context_->ui_task_runner())); 67 host_context_->ui_task_runner()));
68 68
69 // Start monitoring configured policies. 69 // Start monitoring configured policies.
70 policy_watcher_.reset( 70 policy_watcher_.reset(
71 policy_hack::PolicyWatcher::Create(host_context_->network_task_runner())); 71 policy_hack::PolicyWatcher::Create(host_context_->network_task_runner()));
72 policy_watcher_->StartWatching( 72 policy_watcher_->StartWatching(
73 base::Bind(&It2MeHost::OnPolicyUpdate, this)); 73 base::Bind(&It2MeHost::OnPolicyUpdate, this),
74 base::Bind(&It2MeHost::OnPolicyError, this));
74 75
75 // Switch to the network thread to start the actual connection. 76 // Switch to the network thread to start the actual connection.
76 host_context_->network_task_runner()->PostTask( 77 host_context_->network_task_runner()->PostTask(
77 FROM_HERE, base::Bind(&It2MeHost::ReadPolicyAndConnect, this)); 78 FROM_HERE, base::Bind(&It2MeHost::ReadPolicyAndConnect, this));
78 } 79 }
79 80
80 void It2MeHost::Disconnect() { 81 void It2MeHost::Disconnect() {
81 if (!host_context_->network_task_runner()->BelongsToCurrentThread()) { 82 if (!host_context_->network_task_runner()->BelongsToCurrentThread()) {
82 DCHECK(task_runner_->BelongsToCurrentThread()); 83 DCHECK(task_runner_->BelongsToCurrentThread());
83 host_context_->network_task_runner()->PostTask( 84 host_context_->network_task_runner()->PostTask(
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 } 326 }
326 327
327 policy_received_ = true; 328 policy_received_ = true;
328 329
329 if (!pending_connect_.is_null()) { 330 if (!pending_connect_.is_null()) {
330 pending_connect_.Run(); 331 pending_connect_.Run();
331 pending_connect_.Reset(); 332 pending_connect_.Reset();
332 } 333 }
333 } 334 }
334 335
336 void It2MeHost::OnPolicyError() {
Lambros 2014/11/13 00:30:26 optional: NOTIMPLEMENTED()
Łukasz Anforowicz 2014/11/13 17:48:08 Done. I hope that the default policy (4 -- [defau
337 // TODO(lukasza): figure out what to do here...
Lambros 2014/11/13 00:30:26 Maybe keep this simple and just say "Report the po
Łukasz Anforowicz 2014/11/13 17:48:08 Done.
338 // we possibly need equivalent of
339 // void ShutdownHost(HostExitCodes exit_code);
340 // from me2me host (ideally this would be in some kind
341 // of shared code to avoid duplication)
342 }
343
335 void It2MeHost::UpdateNatPolicy(bool nat_traversal_enabled) { 344 void It2MeHost::UpdateNatPolicy(bool nat_traversal_enabled) {
336 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); 345 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
337 346
338 VLOG(2) << "UpdateNatPolicy: " << nat_traversal_enabled; 347 VLOG(2) << "UpdateNatPolicy: " << nat_traversal_enabled;
339 348
340 // When transitioning from enabled to disabled, force disconnect any 349 // When transitioning from enabled to disabled, force disconnect any
341 // existing session. 350 // existing session.
342 if (nat_traversal_enabled_ && !nat_traversal_enabled && IsConnected()) { 351 if (nat_traversal_enabled_ && !nat_traversal_enabled && IsConnected()) {
343 Disconnect(); 352 Disconnect();
344 } 353 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 ChromotingHostContext* context, 476 ChromotingHostContext* context,
468 scoped_refptr<base::SingleThreadTaskRunner> task_runner, 477 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
469 base::WeakPtr<It2MeHost::Observer> observer, 478 base::WeakPtr<It2MeHost::Observer> observer,
470 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, 479 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config,
471 const std::string& directory_bot_jid) { 480 const std::string& directory_bot_jid) {
472 return new It2MeHost( 481 return new It2MeHost(
473 context, task_runner, observer, xmpp_server_config, directory_bot_jid); 482 context, task_runner, observer, xmpp_server_config, directory_bot_jid);
474 } 483 }
475 484
476 } // namespace remoting 485 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698