| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 std::unique_ptr<runtime::EvaluateResult> result) { | 365 std::unique_ptr<runtime::EvaluateResult> result) { |
| 366 std::unique_ptr<base::Value> value = result->Serialize(); | 366 std::unique_ptr<base::Value> value = result->Serialize(); |
| 367 std::string result_json; | 367 std::string result_json; |
| 368 base::JSONWriter::Write(*value, &result_json); | 368 base::JSONWriter::Write(*value, &result_json); |
| 369 printf("%s\n", result_json.c_str()); | 369 printf("%s\n", result_json.c_str()); |
| 370 InputExpression(); | 370 InputExpression(); |
| 371 } | 371 } |
| 372 | 372 |
| 373 void HeadlessShell::CaptureScreenshot() { | 373 void HeadlessShell::CaptureScreenshot() { |
| 374 devtools_client_->GetPage()->GetExperimental()->CaptureScreenshot( | 374 devtools_client_->GetPage()->GetExperimental()->CaptureScreenshot( |
| 375 page::CaptureScreenshotParams::Builder().SetFromSurface(true).Build(), | 375 page::CaptureScreenshotParams::Builder().Build(), |
| 376 base::Bind(&HeadlessShell::OnScreenshotCaptured, | 376 base::Bind(&HeadlessShell::OnScreenshotCaptured, |
| 377 weak_factory_.GetWeakPtr())); | 377 weak_factory_.GetWeakPtr())); |
| 378 } | 378 } |
| 379 | 379 |
| 380 void HeadlessShell::OnScreenshotCaptured( | 380 void HeadlessShell::OnScreenshotCaptured( |
| 381 std::unique_ptr<page::CaptureScreenshotResult> result) { | 381 std::unique_ptr<page::CaptureScreenshotResult> result) { |
| 382 if (!result) { | 382 if (!result) { |
| 383 LOG(ERROR) << "Capture screenshot failed"; | 383 LOG(ERROR) << "Capture screenshot failed"; |
| 384 Shutdown(); | 384 Shutdown(); |
| 385 return; | 385 return; |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 | 678 |
| 679 int HeadlessShellMain(const content::ContentMainParams& params) { | 679 int HeadlessShellMain(const content::ContentMainParams& params) { |
| 680 #if defined(OS_WIN) | 680 #if defined(OS_WIN) |
| 681 return HeadlessShellMain(params.instance, params.sandbox_info); | 681 return HeadlessShellMain(params.instance, params.sandbox_info); |
| 682 #else | 682 #else |
| 683 return HeadlessShellMain(params.argc, params.argv); | 683 return HeadlessShellMain(params.argc, params.argv); |
| 684 #endif | 684 #endif |
| 685 } | 685 } |
| 686 | 686 |
| 687 } // namespace headless | 687 } // namespace headless |
| OLD | NEW |