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

Unified Diff: headless/app/headless_shell.h

Issue 2780433002: add print to pdf for headless (Closed)
Patch Set: fix lint and style errors Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: headless/app/headless_shell.h
diff --git a/headless/app/headless_shell.h b/headless/app/headless_shell.h
index 4b0e83f6cbf3e5dd9f19b495af98d69e60599296..f799c6caf40508ab7754e83bbb1cf1fbdb0d465b 100644
--- a/headless/app/headless_shell.h
+++ b/headless/app/headless_shell.h
@@ -2,6 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#ifndef HEADLESS_APP_HEADLESS_SHELL_H_
+#define HEADLESS_APP_HEADLESS_SHELL_H_
+
+#include <memory>
+#include <string>
+
#include "base/files/file_proxy.h"
#include "base/memory/weak_ptr.h"
#include "headless/app/shell_navigation_request.h"
@@ -63,17 +69,21 @@ class HeadlessShell : public HeadlessWebContents::Observer,
void OnScreenshotCaptured(
std::unique_ptr<page::CaptureScreenshotResult> result);
- void OnScreenshotFileOpened(
- std::unique_ptr<page::CaptureScreenshotResult> result,
- const base::FilePath file_name,
- base::File::Error error_code);
+ void PrintToPDF();
- void OnScreenshotFileWritten(const base::FilePath file_name,
- const int length,
- base::File::Error error_code,
- int write_result);
+ 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.
- void OnScreenshotFileClosed(base::File::Error error_code);
+ void WriteFile(const std::string& switch_string,
+ const std::string& default_file_name,
+ const std::string& data);
+ void OnFileOpened(const std::string& data,
+ const base::FilePath file_name,
+ base::File::Error error_code);
+ void OnFileWritten(const base::FilePath file_name,
+ const int length,
+ base::File::Error error_code,
+ int write_result);
+ void OnFileClosed(base::File::Error error_code);
bool RemoteDebuggingEnabled() const;
@@ -87,7 +97,7 @@ class HeadlessShell : public HeadlessWebContents::Observer,
std::unique_ptr<HeadlessDevToolsClient> devtools_client_;
HeadlessWebContents* web_contents_;
bool processed_page_ready_;
- std::unique_ptr<base::FileProxy> screenshot_file_proxy_;
+ std::unique_ptr<base::FileProxy> file_proxy_;
HeadlessBrowserContext* browser_context_;
std::unique_ptr<DeterministicDispatcher> deterministic_dispatcher_;
base::WeakPtrFactory<HeadlessShell> weak_factory_;
@@ -96,3 +106,5 @@ class HeadlessShell : public HeadlessWebContents::Observer,
};
} // namespace headless
+
+#endif // HEADLESS_APP_HEADLESS_SHELL_H_

Powered by Google App Engine
This is Rietveld 408576698