| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "base/files/file_proxy.h" |
| 5 #include "base/memory/weak_ptr.h" | 6 #include "base/memory/weak_ptr.h" |
| 6 #include "headless/app/shell_navigation_request.h" | 7 #include "headless/app/shell_navigation_request.h" |
| 7 #include "headless/public/devtools/domains/emulation.h" | 8 #include "headless/public/devtools/domains/emulation.h" |
| 8 #include "headless/public/devtools/domains/inspector.h" | 9 #include "headless/public/devtools/domains/inspector.h" |
| 9 #include "headless/public/devtools/domains/page.h" | 10 #include "headless/public/devtools/domains/page.h" |
| 10 #include "headless/public/devtools/domains/runtime.h" | 11 #include "headless/public/devtools/domains/runtime.h" |
| 11 #include "headless/public/headless_browser.h" | 12 #include "headless/public/headless_browser.h" |
| 12 #include "headless/public/headless_devtools_client.h" | 13 #include "headless/public/headless_devtools_client.h" |
| 13 #include "headless/public/headless_web_contents.h" | 14 #include "headless/public/headless_web_contents.h" |
| 14 #include "headless/public/util/deterministic_dispatcher.h" | 15 #include "headless/public/util/deterministic_dispatcher.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 void OnExpressionResult(std::unique_ptr<runtime::EvaluateResult> result); | 59 void OnExpressionResult(std::unique_ptr<runtime::EvaluateResult> result); |
| 59 | 60 |
| 60 void CaptureScreenshot(); | 61 void CaptureScreenshot(); |
| 61 | 62 |
| 62 void OnScreenshotCaptured( | 63 void OnScreenshotCaptured( |
| 63 std::unique_ptr<page::CaptureScreenshotResult> result); | 64 std::unique_ptr<page::CaptureScreenshotResult> result); |
| 64 | 65 |
| 65 void OnScreenshotFileOpened( | 66 void OnScreenshotFileOpened( |
| 66 std::unique_ptr<page::CaptureScreenshotResult> result, | 67 std::unique_ptr<page::CaptureScreenshotResult> result, |
| 67 const base::FilePath file_name, | 68 const base::FilePath file_name, |
| 68 const int open_result); | 69 base::File::Error error_code); |
| 69 | 70 |
| 70 void OnScreenshotFileWritten(const base::FilePath file_name, | 71 void OnScreenshotFileWritten(const base::FilePath file_name, |
| 71 const int length, | 72 const int length, |
| 72 const int write_result); | 73 base::File::Error error_code, |
| 74 int write_result); |
| 73 | 75 |
| 74 void OnScreenshotFileClosed(const int close_result); | 76 void OnScreenshotFileClosed(base::File::Error error_code); |
| 75 | 77 |
| 76 bool RemoteDebuggingEnabled() const; | 78 bool RemoteDebuggingEnabled() const; |
| 77 | 79 |
| 78 HeadlessDevToolsClient* devtools_client() const { | 80 HeadlessDevToolsClient* devtools_client() const { |
| 79 return devtools_client_.get(); | 81 return devtools_client_.get(); |
| 80 } | 82 } |
| 81 | 83 |
| 82 private: | 84 private: |
| 83 GURL url_; | 85 GURL url_; |
| 84 HeadlessBrowser* browser_; // Not owned. | 86 HeadlessBrowser* browser_; // Not owned. |
| 85 std::unique_ptr<HeadlessDevToolsClient> devtools_client_; | 87 std::unique_ptr<HeadlessDevToolsClient> devtools_client_; |
| 86 HeadlessWebContents* web_contents_; | 88 HeadlessWebContents* web_contents_; |
| 87 bool processed_page_ready_; | 89 bool processed_page_ready_; |
| 88 std::unique_ptr<net::FileStream> screenshot_file_stream_; | 90 std::unique_ptr<base::FileProxy> screenshot_file_proxy_; |
| 89 HeadlessBrowserContext* browser_context_; | 91 HeadlessBrowserContext* browser_context_; |
| 90 std::unique_ptr<DeterministicDispatcher> deterministic_dispatcher_; | 92 std::unique_ptr<DeterministicDispatcher> deterministic_dispatcher_; |
| 91 base::WeakPtrFactory<HeadlessShell> weak_factory_; | 93 base::WeakPtrFactory<HeadlessShell> weak_factory_; |
| 92 | 94 |
| 93 DISALLOW_COPY_AND_ASSIGN(HeadlessShell); | 95 DISALLOW_COPY_AND_ASSIGN(HeadlessShell); |
| 94 }; | 96 }; |
| 95 | 97 |
| 96 } // namespace headless | 98 } // namespace headless |
| OLD | NEW |