| 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> |
| 6 |
| 5 #include "base/bind.h" | 7 #include "base/bind.h" |
| 6 #include "base/callback.h" | 8 #include "base/callback.h" |
| 7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 8 #include "base/location.h" | 10 #include "base/location.h" |
| 9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 10 #include "base/numerics/safe_conversions.h" | 12 #include "base/numerics/safe_conversions.h" |
| 11 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 12 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
| 13 #include "headless/app/headless_shell_switches.h" | 15 #include "headless/app/headless_shell_switches.h" |
| 14 #include "headless/public/headless_browser.h" | 16 #include "headless/public/headless_browser.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 68 |
| 67 // HeadlessWebContents::Observer implementation: | 69 // HeadlessWebContents::Observer implementation: |
| 68 void DocumentOnLoadCompletedInMainFrame() override { | 70 void DocumentOnLoadCompletedInMainFrame() override { |
| 69 ShutdownIfNeeded(); | 71 ShutdownIfNeeded(); |
| 70 } | 72 } |
| 71 | 73 |
| 72 void DidFinishNavigation(bool success) override {} | 74 void DidFinishNavigation(bool success) override {} |
| 73 | 75 |
| 74 private: | 76 private: |
| 75 HeadlessBrowser* browser_; // Not owned. | 77 HeadlessBrowser* browser_; // Not owned. |
| 76 scoped_ptr<HeadlessWebContents> web_contents_; | 78 std::unique_ptr<HeadlessWebContents> web_contents_; |
| 77 | 79 |
| 78 DISALLOW_COPY_AND_ASSIGN(HeadlessShell); | 80 DISALLOW_COPY_AND_ASSIGN(HeadlessShell); |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 int main(int argc, const char** argv) { | 83 int main(int argc, const char** argv) { |
| 82 HeadlessShell shell; | 84 HeadlessShell shell; |
| 83 HeadlessBrowser::Options::Builder builder(argc, argv); | 85 HeadlessBrowser::Options::Builder builder(argc, argv); |
| 84 | 86 |
| 85 // Enable devtools if requested. | 87 // Enable devtools if requested. |
| 86 base::CommandLine command_line(argc, argv); | 88 base::CommandLine command_line(argc, argv); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 108 LOG(ERROR) << "Malformed proxy server url"; | 110 LOG(ERROR) << "Malformed proxy server url"; |
| 109 return EXIT_FAILURE; | 111 return EXIT_FAILURE; |
| 110 } | 112 } |
| 111 builder.SetProxyServer(parsed_proxy_server); | 113 builder.SetProxyServer(parsed_proxy_server); |
| 112 } | 114 } |
| 113 | 115 |
| 114 return HeadlessBrowserMain( | 116 return HeadlessBrowserMain( |
| 115 builder.Build(), | 117 builder.Build(), |
| 116 base::Bind(&HeadlessShell::OnStart, base::Unretained(&shell))); | 118 base::Bind(&HeadlessShell::OnStart, base::Unretained(&shell))); |
| 117 } | 119 } |
| OLD | NEW |