| OLD | NEW |
| 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/core/session/assignment_source.h" | 5 #include "blimp/client/core/session/assignment_source.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 } | 107 } |
| 108 | 108 |
| 109 // Populates an Assignment using command-line parameters, if provided. | 109 // Populates an Assignment using command-line parameters, if provided. |
| 110 // Returns a null Assignment if no parameters were set. | 110 // Returns a null Assignment if no parameters were set. |
| 111 // Must be called on a thread suitable for file IO. | 111 // Must be called on a thread suitable for file IO. |
| 112 Assignment GetAssignmentFromCommandLine() { | 112 Assignment GetAssignmentFromCommandLine() { |
| 113 Assignment assignment; | 113 Assignment assignment; |
| 114 | 114 |
| 115 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 115 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 116 assignment.client_auth_token = GetClientAuthToken(*cmd_line); | 116 assignment.client_auth_token = GetClientAuthToken(*cmd_line); |
| 117 CHECK(!assignment.client_auth_token.empty()) | 117 // No client auth token provided. |
| 118 << "No client auth token provided."; | 118 CHECK(!assignment.client_auth_token.empty()); |
| 119 | 119 |
| 120 unsigned port_parsed = 0; | 120 unsigned port_parsed = 0; |
| 121 if (!base::StringToUint( | 121 if (!base::StringToUint( |
| 122 cmd_line->GetSwitchValueASCII(switches::kEnginePort), | 122 cmd_line->GetSwitchValueASCII(switches::kEnginePort), |
| 123 &port_parsed) || !IsValidIpPortNumber(port_parsed)) { | 123 &port_parsed) || !IsValidIpPortNumber(port_parsed)) { |
| 124 DLOG(FATAL) << "--engine-port must be a value between 1 and 65535."; | 124 DLOG(FATAL) << "--engine-port must be a value between 1 and 65535."; |
| 125 return Assignment(); | 125 return Assignment(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 net::IPAddress ip_address; | 128 net::IPAddress ip_address; |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 } | 375 } |
| 376 | 376 |
| 377 void AssignmentSource::OnJsonParseError(const std::string& error) { | 377 void AssignmentSource::OnJsonParseError(const std::string& error) { |
| 378 DLOG(ERROR) << "Error while parsing assigner JSON: " << error; | 378 DLOG(ERROR) << "Error while parsing assigner JSON: " << error; |
| 379 base::ResetAndReturn(&callback_) | 379 base::ResetAndReturn(&callback_) |
| 380 .Run(ASSIGNMENT_REQUEST_RESULT_BAD_RESPONSE, Assignment()); | 380 .Run(ASSIGNMENT_REQUEST_RESULT_BAD_RESPONSE, Assignment()); |
| 381 } | 381 } |
| 382 | 382 |
| 383 } // namespace client | 383 } // namespace client |
| 384 } // namespace blimp | 384 } // namespace blimp |
| OLD | NEW |