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

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: Rebased and reopened to try memory trybots. Created 6 years 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
« no previous file with comments | « remoting/host/it2me/it2me_host.h ('k') | remoting/host/policy_hack/fake_policy_watcher.h » ('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 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/threading/platform_thread.h" 9 #include "base/threading/platform_thread.h"
10 #include "net/socket/client_socket_factory.h" 10 #include "net/socket/client_socket_factory.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 FROM_HERE, base::Bind(&It2MeHost::Connect, this)); 60 FROM_HERE, base::Bind(&It2MeHost::Connect, this));
61 return; 61 return;
62 } 62 }
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_->StartWatching(base::Bind(&It2MeHost::OnPolicyUpdate, this)); 70 policy_watcher_->StartWatching(
71 base::Bind(&It2MeHost::OnPolicyUpdate, this),
72 base::Bind(&It2MeHost::OnPolicyError, this));
71 73
72 // Switch to the network thread to start the actual connection. 74 // Switch to the network thread to start the actual connection.
73 host_context_->network_task_runner()->PostTask( 75 host_context_->network_task_runner()->PostTask(
74 FROM_HERE, base::Bind(&It2MeHost::ReadPolicyAndConnect, this)); 76 FROM_HERE, base::Bind(&It2MeHost::ReadPolicyAndConnect, this));
75 } 77 }
76 78
77 void It2MeHost::Disconnect() { 79 void It2MeHost::Disconnect() {
78 if (!host_context_->network_task_runner()->BelongsToCurrentThread()) { 80 if (!host_context_->network_task_runner()->BelongsToCurrentThread()) {
79 DCHECK(task_runner_->BelongsToCurrentThread()); 81 DCHECK(task_runner_->BelongsToCurrentThread());
80 host_context_->network_task_runner()->PostTask( 82 host_context_->network_task_runner()->PostTask(
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 } 334 }
333 335
334 policy_received_ = true; 336 policy_received_ = true;
335 337
336 if (!pending_connect_.is_null()) { 338 if (!pending_connect_.is_null()) {
337 pending_connect_.Run(); 339 pending_connect_.Run();
338 pending_connect_.Reset(); 340 pending_connect_.Reset();
339 } 341 }
340 } 342 }
341 343
344 void It2MeHost::OnPolicyError() {
345 // TODO(lukasza): Report the policy error to the user. crbug.com/433009
346 NOTIMPLEMENTED();
347 }
348
342 void It2MeHost::UpdateNatPolicy(bool nat_traversal_enabled) { 349 void It2MeHost::UpdateNatPolicy(bool nat_traversal_enabled) {
343 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); 350 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
344 351
345 VLOG(2) << "UpdateNatPolicy: " << nat_traversal_enabled; 352 VLOG(2) << "UpdateNatPolicy: " << nat_traversal_enabled;
346 353
347 // When transitioning from enabled to disabled, force disconnect any 354 // When transitioning from enabled to disabled, force disconnect any
348 // existing session. 355 // existing session.
349 if (nat_traversal_enabled_ && !nat_traversal_enabled && IsConnected()) { 356 if (nat_traversal_enabled_ && !nat_traversal_enabled && IsConnected()) {
350 Disconnect(); 357 Disconnect();
351 } 358 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, 491 const XmppSignalStrategy::XmppServerConfig& xmpp_server_config,
485 const std::string& directory_bot_jid) { 492 const std::string& directory_bot_jid) {
486 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher = 493 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher =
487 policy_hack::PolicyWatcher::Create(policy_service_, 494 policy_hack::PolicyWatcher::Create(policy_service_,
488 context->network_task_runner()); 495 context->network_task_runner());
489 return new It2MeHost(context.Pass(), policy_watcher.Pass(), observer, 496 return new It2MeHost(context.Pass(), policy_watcher.Pass(), observer,
490 xmpp_server_config, directory_bot_jid); 497 xmpp_server_config, directory_bot_jid);
491 } 498 }
492 499
493 } // namespace remoting 500 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/it2me/it2me_host.h ('k') | remoting/host/policy_hack/fake_policy_watcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698