| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdio.h> | 5 #include <stdio.h> |
| 6 #include <termios.h> | 6 #include <termios.h> |
| 7 | 7 |
| 8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 case HostStarter::START_ERROR: | 79 case HostStarter::START_ERROR: |
| 80 fprintf(stderr, "Couldn't start host.\n"); | 80 fprintf(stderr, "Couldn't start host.\n"); |
| 81 break; | 81 break; |
| 82 } | 82 } |
| 83 | 83 |
| 84 g_message_loop->QuitNow(); | 84 g_message_loop->QuitNow(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 int main(int argc, char** argv) { | 87 int main(int argc, char** argv) { |
| 88 // google_apis::GetOAuth2ClientID/Secret need a static CommandLine. | 88 // google_apis::GetOAuth2ClientID/Secret need a static CommandLine. |
| 89 CommandLine::Init(argc, argv); | 89 base::CommandLine::Init(argc, argv); |
| 90 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 90 const base::CommandLine* command_line = |
| 91 base::CommandLine::ForCurrentProcess(); |
| 91 | 92 |
| 92 std::string host_name = command_line->GetSwitchValueASCII("name"); | 93 std::string host_name = command_line->GetSwitchValueASCII("name"); |
| 93 std::string host_pin = command_line->GetSwitchValueASCII("pin"); | 94 std::string host_pin = command_line->GetSwitchValueASCII("pin"); |
| 94 std::string auth_code = command_line->GetSwitchValueASCII("code"); | 95 std::string auth_code = command_line->GetSwitchValueASCII("code"); |
| 95 std::string redirect_url = command_line->GetSwitchValueASCII("redirect-url"); | 96 std::string redirect_url = command_line->GetSwitchValueASCII("redirect-url"); |
| 96 | 97 |
| 97 if (host_name.empty()) { | 98 if (host_name.empty()) { |
| 98 fprintf(stderr, | 99 fprintf(stderr, |
| 99 "Usage: %s --name=<hostname> [--code=<auth-code>] [--pin=<PIN>] " | 100 "Usage: %s --name=<hostname> [--code=<auth-code>] [--pin=<PIN>] " |
| 100 "[--redirect-url=<redirectURL>]\n", | 101 "[--redirect-url=<redirectURL>]\n", |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 172 |
| 172 // Destroy the HostStarter and URLRequestContextGetter before stopping the | 173 // Destroy the HostStarter and URLRequestContextGetter before stopping the |
| 173 // IO thread. | 174 // IO thread. |
| 174 host_starter.reset(); | 175 host_starter.reset(); |
| 175 url_request_context_getter = NULL; | 176 url_request_context_getter = NULL; |
| 176 | 177 |
| 177 io_thread.Stop(); | 178 io_thread.Stop(); |
| 178 | 179 |
| 179 return g_started ? 0 : 1; | 180 return g_started ? 0 : 1; |
| 180 } | 181 } |
| OLD | NEW |