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

Side by Side Diff: blimp/client/session/assignment_source.cc

Issue 1676023002: Make IPAddress::FromIPLiteral a member function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "blimp/client/session/assignment_source.h" 5 #include "blimp/client/session/assignment_source.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
(...skipping 13 matching lines...) Expand all
24 net::IPAddress GetBlimpletIPAddress() { 24 net::IPAddress GetBlimpletIPAddress() {
25 std::string host; 25 std::string host;
26 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 26 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
27 switches::kBlimpletHost)) { 27 switches::kBlimpletHost)) {
28 host = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 28 host = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
29 switches::kBlimpletHost); 29 switches::kBlimpletHost);
30 } else { 30 } else {
31 host = kDefaultBlimpletIPAddress; 31 host = kDefaultBlimpletIPAddress;
32 } 32 }
33 net::IPAddress ip_address; 33 net::IPAddress ip_address;
34 if (!net::IPAddress::FromIPLiteral(host, &ip_address)) 34 if (!ip_address.AssignFromIPLiteral(host))
35 CHECK(false) << "Invalid BlimpletAssignment host " << host; 35 CHECK(false) << "Invalid BlimpletAssignment host " << host;
36 return ip_address; 36 return ip_address;
37 } 37 }
38 38
39 uint16_t GetBlimpletTCPPort() { 39 uint16_t GetBlimpletTCPPort() {
40 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 40 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
41 switches::kBlimpletTCPPort)) { 41 switches::kBlimpletTCPPort)) {
42 std::string port_str = 42 std::string port_str =
43 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 43 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
44 switches::kBlimpletTCPPort); 44 switches::kBlimpletTCPPort);
(...skipping 22 matching lines...) Expand all
67 DCHECK(main_task_runner_->BelongsToCurrentThread()); 67 DCHECK(main_task_runner_->BelongsToCurrentThread());
68 Assignment assignment; 68 Assignment assignment;
69 assignment.ip_endpoint = 69 assignment.ip_endpoint =
70 net::IPEndPoint(GetBlimpletIPAddress(), GetBlimpletTCPPort()); 70 net::IPEndPoint(GetBlimpletIPAddress(), GetBlimpletTCPPort());
71 assignment.client_token = kDummyClientToken; 71 assignment.client_token = kDummyClientToken;
72 main_task_runner_->PostTask(FROM_HERE, base::Bind(callback, assignment)); 72 main_task_runner_->PostTask(FROM_HERE, base::Bind(callback, assignment));
73 } 73 }
74 74
75 } // namespace client 75 } // namespace client
76 } // namespace blimp 76 } // namespace blimp
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/devtools/device/cast_device_provider_unittest.cc » ('j') | net/base/ip_address_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698