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 2901033002: Host port range policy is no longer ignored in it2me host (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « remoting/host/it2me/it2me_host.h ('k') | no next file » | 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 <cstdint> 7 #include <cstdint>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 const base::ListValue* client_domain_list; 323 const base::ListValue* client_domain_list;
324 if (policies->GetList(policy::key::kRemoteAccessHostClientDomainList, 324 if (policies->GetList(policy::key::kRemoteAccessHostClientDomainList,
325 &client_domain_list)) { 325 &client_domain_list)) {
326 std::vector<std::string> client_domain_list_vector; 326 std::vector<std::string> client_domain_list_vector;
327 for (const auto& value : *client_domain_list) { 327 for (const auto& value : *client_domain_list) {
328 client_domain_list_vector.push_back(value.GetString()); 328 client_domain_list_vector.push_back(value.GetString());
329 } 329 }
330 UpdateClientDomainListPolicy(std::move(client_domain_list_vector)); 330 UpdateClientDomainListPolicy(std::move(client_domain_list_vector));
331 } 331 }
332 332
333 // TODO(gusss) don't ignore port range
334 std::string port_range_string;
335 if (policies->GetString(policy::key::kRemoteAccessHostUdpPortRange,
336 &port_range_string)) {
337 UpdateHostUdpPortRangePolicy(port_range_string);
338 }
339
333 policy_received_ = true; 340 policy_received_ = true;
334 341
335 if (!pending_connect_.is_null()) { 342 if (!pending_connect_.is_null()) {
336 base::ResetAndReturn(&pending_connect_).Run(); 343 base::ResetAndReturn(&pending_connect_).Run();
337 } 344 }
338 } 345 }
339 346
340 void It2MeHost::UpdateNatPolicy(bool nat_traversal_enabled) { 347 void It2MeHost::UpdateNatPolicy(bool nat_traversal_enabled) {
341 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); 348 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
342 349
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 << base::JoinString(client_domain_list, ", "); 386 << base::JoinString(client_domain_list, ", ");
380 387
381 // When setting a client domain policy, disconnect any existing session. 388 // When setting a client domain policy, disconnect any existing session.
382 if (!client_domain_list.empty() && IsRunning()) { 389 if (!client_domain_list.empty() && IsRunning()) {
383 DisconnectOnNetworkThread(); 390 DisconnectOnNetworkThread();
384 } 391 }
385 392
386 required_client_domain_list_ = std::move(client_domain_list); 393 required_client_domain_list_ = std::move(client_domain_list);
387 } 394 }
388 395
396 void It2MeHost::UpdateHostUdpPortRangePolicy(std::string port_range_string) {
397 // TODO(gusss) i copied this; need to figure out what it actually does!
Sergey Ulanov 2017/05/23 20:11:01 It verifies that this function is called on the ri
398 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
399
400 VLOG(2) << "UpdateHostUdpPortRangePolicy: " << port_range_string;
401
402 if (!PortRange::Parse(port_range_string, &udp_port_range_)) {
403 // TODO(gusss) how to handle formatting error in this case?
Sergey Ulanov 2017/05/23 20:11:01 I think we need to stop the host in this case. I t
404 }
405
406 // TODO(gusss) do we have to disconnect?
Sergey Ulanov 2017/05/23 20:11:01 Yes, same as in UpdateClientDomainListPolicy()
407 }
408
389 void It2MeHost::SetState(It2MeHostState state, 409 void It2MeHost::SetState(It2MeHostState state,
390 const std::string& error_message) { 410 const std::string& error_message) {
391 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread()); 411 DCHECK(host_context_->network_task_runner()->BelongsToCurrentThread());
392 412
393 switch (state_) { 413 switch (state_) {
394 case kDisconnected: 414 case kDisconnected:
395 DCHECK(state == kStarting || 415 DCHECK(state == kStarting ||
396 state == kError) << state; 416 state == kError) << state;
397 break; 417 break;
398 case kStarting: 418 case kStarting:
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 std::unique_ptr<SignalStrategy> signal_strategy, 596 std::unique_ptr<SignalStrategy> signal_strategy,
577 const std::string& username, 597 const std::string& username,
578 const std::string& directory_bot_jid) { 598 const std::string& directory_bot_jid) {
579 DCHECK(context->ui_task_runner()->BelongsToCurrentThread()); 599 DCHECK(context->ui_task_runner()->BelongsToCurrentThread());
580 return new It2MeHost( 600 return new It2MeHost(
581 std::move(context), base::MakeUnique<It2MeConfirmationDialogFactory>(), 601 std::move(context), base::MakeUnique<It2MeConfirmationDialogFactory>(),
582 observer, std::move(signal_strategy), username, directory_bot_jid); 602 observer, std::move(signal_strategy), username, directory_bot_jid);
583 } 603 }
584 604
585 } // namespace remoting 605 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/it2me/it2me_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698