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 <memory> | 5 #include <memory> |
6 #include <sstream> | 6 #include <sstream> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 } | 272 } |
273 Shutdown(); | 273 Shutdown(); |
274 } | 274 } |
275 | 275 |
276 void InputExpression() { | 276 void InputExpression() { |
277 // Note that a real system should read user input asynchronously, because | 277 // Note that a real system should read user input asynchronously, because |
278 // otherwise all other browser activity is suspended (e.g., page loading). | 278 // otherwise all other browser activity is suspended (e.g., page loading). |
279 printf(">>> "); | 279 printf(">>> "); |
280 std::stringstream expression; | 280 std::stringstream expression; |
281 while (true) { | 281 while (true) { |
282 char c = fgetc(stdin); | 282 int c = fgetc(stdin); |
283 if (c == EOF || c == '\n') { | 283 if (c == EOF || c == '\n') { |
284 break; | 284 break; |
285 } | 285 } |
286 expression << c; | 286 expression << c; |
287 } | 287 } |
288 if (expression.str() == "quit") { | 288 if (expression.str() == "quit") { |
289 Shutdown(); | 289 Shutdown(); |
290 return; | 290 return; |
291 } | 291 } |
292 devtools_client_->GetRuntime()->Evaluate( | 292 devtools_client_->GetRuntime()->Evaluate( |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 } | 470 } |
471 builder.SetWindowSize(parsed_window_size); | 471 builder.SetWindowSize(parsed_window_size); |
472 } | 472 } |
473 | 473 |
474 return HeadlessBrowserMain( | 474 return HeadlessBrowserMain( |
475 builder.Build(), | 475 builder.Build(), |
476 base::Bind(&HeadlessShell::OnStart, base::Unretained(&shell))); | 476 base::Bind(&HeadlessShell::OnStart, base::Unretained(&shell))); |
477 } | 477 } |
478 | 478 |
479 } // namespace headless | 479 } // namespace headless |
OLD | NEW |