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 #ifndef HEADLESS_APP_HEADLESS_SHELL_H_ | |
6 #define HEADLESS_APP_HEADLESS_SHELL_H_ | |
7 | |
8 #include <memory> | |
9 #include <string> | |
10 | |
5 #include "base/files/file_proxy.h" | 11 #include "base/files/file_proxy.h" |
6 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
7 #include "headless/app/shell_navigation_request.h" | 13 #include "headless/app/shell_navigation_request.h" |
8 #include "headless/public/devtools/domains/emulation.h" | 14 #include "headless/public/devtools/domains/emulation.h" |
9 #include "headless/public/devtools/domains/inspector.h" | 15 #include "headless/public/devtools/domains/inspector.h" |
10 #include "headless/public/devtools/domains/page.h" | 16 #include "headless/public/devtools/domains/page.h" |
11 #include "headless/public/devtools/domains/runtime.h" | 17 #include "headless/public/devtools/domains/runtime.h" |
12 #include "headless/public/headless_browser.h" | 18 #include "headless/public/headless_browser.h" |
13 #include "headless/public/headless_devtools_client.h" | 19 #include "headless/public/headless_devtools_client.h" |
14 #include "headless/public/headless_web_contents.h" | 20 #include "headless/public/headless_web_contents.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 | 62 |
57 void InputExpression(); | 63 void InputExpression(); |
58 | 64 |
59 void OnExpressionResult(std::unique_ptr<runtime::EvaluateResult> result); | 65 void OnExpressionResult(std::unique_ptr<runtime::EvaluateResult> result); |
60 | 66 |
61 void CaptureScreenshot(); | 67 void CaptureScreenshot(); |
62 | 68 |
63 void OnScreenshotCaptured( | 69 void OnScreenshotCaptured( |
64 std::unique_ptr<page::CaptureScreenshotResult> result); | 70 std::unique_ptr<page::CaptureScreenshotResult> result); |
65 | 71 |
66 void OnScreenshotFileOpened( | 72 void PrintToPDF(); |
67 std::unique_ptr<page::CaptureScreenshotResult> result, | |
68 const base::FilePath file_name, | |
69 base::File::Error error_code); | |
70 | 73 |
71 void OnScreenshotFileWritten(const base::FilePath file_name, | 74 void OnPDFCreated(std::unique_ptr<page::PrintToPDFResult> result); |
Lei Zhang
2017/03/29 05:30:15
Can this and methods below be private?
Eric Seckler
2017/03/29 11:21:19
If you move those to private (which I don't object
jzfeng
2017/03/30 03:04:57
Sure. Done.
| |
72 const int length, | |
73 base::File::Error error_code, | |
74 int write_result); | |
75 | 75 |
76 void OnScreenshotFileClosed(base::File::Error error_code); | 76 void WriteFile(const std::string& switch_string, |
77 const std::string& default_file_name, | |
78 const std::string& data); | |
79 void OnFileOpened(const std::string& data, | |
80 const base::FilePath file_name, | |
81 base::File::Error error_code); | |
82 void OnFileWritten(const base::FilePath file_name, | |
83 const int length, | |
84 base::File::Error error_code, | |
85 int write_result); | |
86 void OnFileClosed(base::File::Error error_code); | |
77 | 87 |
78 bool RemoteDebuggingEnabled() const; | 88 bool RemoteDebuggingEnabled() const; |
79 | 89 |
80 HeadlessDevToolsClient* devtools_client() const { | 90 HeadlessDevToolsClient* devtools_client() const { |
81 return devtools_client_.get(); | 91 return devtools_client_.get(); |
82 } | 92 } |
83 | 93 |
84 private: | 94 private: |
85 GURL url_; | 95 GURL url_; |
86 HeadlessBrowser* browser_; // Not owned. | 96 HeadlessBrowser* browser_; // Not owned. |
87 std::unique_ptr<HeadlessDevToolsClient> devtools_client_; | 97 std::unique_ptr<HeadlessDevToolsClient> devtools_client_; |
88 HeadlessWebContents* web_contents_; | 98 HeadlessWebContents* web_contents_; |
89 bool processed_page_ready_; | 99 bool processed_page_ready_; |
90 std::unique_ptr<base::FileProxy> screenshot_file_proxy_; | 100 std::unique_ptr<base::FileProxy> file_proxy_; |
91 HeadlessBrowserContext* browser_context_; | 101 HeadlessBrowserContext* browser_context_; |
92 std::unique_ptr<DeterministicDispatcher> deterministic_dispatcher_; | 102 std::unique_ptr<DeterministicDispatcher> deterministic_dispatcher_; |
93 base::WeakPtrFactory<HeadlessShell> weak_factory_; | 103 base::WeakPtrFactory<HeadlessShell> weak_factory_; |
94 | 104 |
95 DISALLOW_COPY_AND_ASSIGN(HeadlessShell); | 105 DISALLOW_COPY_AND_ASSIGN(HeadlessShell); |
96 }; | 106 }; |
97 | 107 |
98 } // namespace headless | 108 } // namespace headless |
109 | |
110 #endif // HEADLESS_APP_HEADLESS_SHELL_H_ | |
OLD | NEW |