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/files/file_proxy.h" |
6 #include "base/memory/weak_ptr.h" | 6 #include "base/memory/weak_ptr.h" |
7 #include "headless/app/shell_navigation_request.h" | 7 #include "headless/app/shell_navigation_request.h" |
8 #include "headless/public/devtools/domains/emulation.h" | 8 #include "headless/public/devtools/domains/emulation.h" |
9 #include "headless/public/devtools/domains/inspector.h" | 9 #include "headless/public/devtools/domains/inspector.h" |
10 #include "headless/public/devtools/domains/page.h" | 10 #include "headless/public/devtools/domains/page.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 void InputExpression(); | 57 void InputExpression(); |
58 | 58 |
59 void OnExpressionResult(std::unique_ptr<runtime::EvaluateResult> result); | 59 void OnExpressionResult(std::unique_ptr<runtime::EvaluateResult> result); |
60 | 60 |
61 void CaptureScreenshot(); | 61 void CaptureScreenshot(); |
62 | 62 |
63 void OnScreenshotCaptured( | 63 void OnScreenshotCaptured( |
64 std::unique_ptr<page::CaptureScreenshotResult> result); | 64 std::unique_ptr<page::CaptureScreenshotResult> result); |
65 | 65 |
66 void OnScreenshotFileOpened( | 66 void PrintToPDF(); |
67 std::unique_ptr<page::CaptureScreenshotResult> result, | |
68 const base::FilePath file_name, | |
69 base::File::Error error_code); | |
70 | 67 |
71 void OnScreenshotFileWritten(const base::FilePath file_name, | 68 void OnPDFCreated(std::unique_ptr<page::PrintToPDFResult> result); |
72 const int length, | |
73 base::File::Error error_code, | |
74 int write_result); | |
75 | 69 |
76 void OnScreenshotFileClosed(base::File::Error error_code); | 70 void WriteFile(const std::string& switch_string, |
| 71 const std::string& default_file_name, |
| 72 const std::string& data); |
| 73 void OnFileOpened(const std::string& data, |
| 74 const base::FilePath file_name, |
| 75 base::File::Error error_code); |
| 76 void OnFileWritten(const base::FilePath file_name, |
| 77 const int length, |
| 78 base::File::Error error_code, |
| 79 int write_result); |
| 80 void OnFileClosed(base::File::Error error_code); |
77 | 81 |
78 bool RemoteDebuggingEnabled() const; | 82 bool RemoteDebuggingEnabled() const; |
79 | 83 |
80 HeadlessDevToolsClient* devtools_client() const { | 84 HeadlessDevToolsClient* devtools_client() const { |
81 return devtools_client_.get(); | 85 return devtools_client_.get(); |
82 } | 86 } |
83 | 87 |
84 private: | 88 private: |
85 GURL url_; | 89 GURL url_; |
86 HeadlessBrowser* browser_; // Not owned. | 90 HeadlessBrowser* browser_; // Not owned. |
87 std::unique_ptr<HeadlessDevToolsClient> devtools_client_; | 91 std::unique_ptr<HeadlessDevToolsClient> devtools_client_; |
88 HeadlessWebContents* web_contents_; | 92 HeadlessWebContents* web_contents_; |
89 bool processed_page_ready_; | 93 bool processed_page_ready_; |
90 std::unique_ptr<base::FileProxy> screenshot_file_proxy_; | 94 std::unique_ptr<base::FileProxy> file_proxy_; |
91 HeadlessBrowserContext* browser_context_; | 95 HeadlessBrowserContext* browser_context_; |
92 std::unique_ptr<DeterministicDispatcher> deterministic_dispatcher_; | 96 std::unique_ptr<DeterministicDispatcher> deterministic_dispatcher_; |
93 base::WeakPtrFactory<HeadlessShell> weak_factory_; | 97 base::WeakPtrFactory<HeadlessShell> weak_factory_; |
94 | 98 |
95 DISALLOW_COPY_AND_ASSIGN(HeadlessShell); | 99 DISALLOW_COPY_AND_ASSIGN(HeadlessShell); |
96 }; | 100 }; |
97 | 101 |
98 } // namespace headless | 102 } // namespace headless |
OLD | NEW |