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 "remoting/host/setup/start_host_main.h" | 5 #include "remoting/host/setup/start_host_main.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 size_t newline_index = str.find('\n'); | 81 size_t newline_index = str.find('\n'); |
82 if (newline_index != std::string::npos) | 82 if (newline_index != std::string::npos) |
83 str[newline_index] = '\0'; | 83 str[newline_index] = '\0'; |
84 str.resize(strlen(&str[0])); | 84 str.resize(strlen(&str[0])); |
85 return str; | 85 return str; |
86 } | 86 } |
87 | 87 |
88 // Called when the HostStarter has finished. | 88 // Called when the HostStarter has finished. |
89 void OnDone(HostStarter::Result result) { | 89 void OnDone(HostStarter::Result result) { |
90 if (!g_message_loop->task_runner()->BelongsToCurrentThread()) { | 90 if (!g_message_loop->task_runner()->BelongsToCurrentThread()) { |
91 g_message_loop->PostTask(FROM_HERE, base::Bind(&OnDone, result)); | 91 g_message_loop->task_runner()->PostTask(FROM_HERE, |
| 92 base::Bind(&OnDone, result)); |
92 return; | 93 return; |
93 } | 94 } |
94 switch (result) { | 95 switch (result) { |
95 case HostStarter::START_COMPLETE: | 96 case HostStarter::START_COMPLETE: |
96 g_started = true; | 97 g_started = true; |
97 break; | 98 break; |
98 case HostStarter::NETWORK_ERROR: | 99 case HostStarter::NETWORK_ERROR: |
99 fprintf(stderr, "Couldn't start host: network error.\n"); | 100 fprintf(stderr, "Couldn't start host: network error.\n"); |
100 break; | 101 break; |
101 case HostStarter::OAUTH_ERROR: | 102 case HostStarter::OAUTH_ERROR: |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 // IO thread. | 234 // IO thread. |
234 host_starter.reset(); | 235 host_starter.reset(); |
235 url_request_context_getter = nullptr; | 236 url_request_context_getter = nullptr; |
236 | 237 |
237 io_thread.Stop(); | 238 io_thread.Stop(); |
238 | 239 |
239 return g_started ? 0 : 1; | 240 return g_started ? 0 : 1; |
240 } | 241 } |
241 | 242 |
242 } // namespace remoting | 243 } // namespace remoting |
OLD | NEW |