Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: headless/app/headless_shell.cc

Issue 2246113004: [headless] Fix headless_shell compilation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <iostream> 5 #include <iostream>
6 #include <memory> 6 #include <memory>
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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 202 }
203 } 203 }
204 204
205 void FetchDom() { 205 void FetchDom() {
206 devtools_client_->GetRuntime()->Evaluate( 206 devtools_client_->GetRuntime()->Evaluate(
207 "document.body.innerHTML", 207 "document.body.innerHTML",
208 base::Bind(&HeadlessShell::OnDomFetched, base::Unretained(this))); 208 base::Bind(&HeadlessShell::OnDomFetched, base::Unretained(this)));
209 } 209 }
210 210
211 void OnDomFetched(std::unique_ptr<runtime::EvaluateResult> result) { 211 void OnDomFetched(std::unique_ptr<runtime::EvaluateResult> result) {
212 if (result->GetWasThrown()) { 212 if (result->GetExceptionDetails()) {
213 LOG(ERROR) << "Failed to evaluate document.body.innerHTML"; 213 LOG(ERROR) << "Failed to evaluate document.body.innerHTML";
214 } else { 214 } else {
215 std::string dom; 215 std::string dom;
216 if (result->GetResult()->GetValue()->GetAsString(&dom)) { 216 if (result->GetResult()->GetValue()->GetAsString(&dom)) {
217 std::cout << dom << std::endl; 217 std::cout << dom << std::endl;
218 } 218 }
219 } 219 }
220 Shutdown(); 220 Shutdown();
221 } 221 }
222 222
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 LOG(ERROR) << "Malformed window size"; 407 LOG(ERROR) << "Malformed window size";
408 return EXIT_FAILURE; 408 return EXIT_FAILURE;
409 } 409 }
410 builder.SetWindowSize(parsed_window_size); 410 builder.SetWindowSize(parsed_window_size);
411 } 411 }
412 412
413 return HeadlessBrowserMain( 413 return HeadlessBrowserMain(
414 builder.Build(), 414 builder.Build(),
415 base::Bind(&HeadlessShell::OnStart, base::Unretained(&shell))); 415 base::Bind(&HeadlessShell::OnStart, base::Unretained(&shell)));
416 } 416 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698