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

Side by Side Diff: headless/lib/browser/headless_print_manager.h

Issue 2762593002: Add --headless flag to Windows (Closed)
Patch Set: added TODO Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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_LIB_BROWSER_HEADLESS_PRINT_MANAGER_H_ 5 #ifndef HEADLESS_LIB_BROWSER_HEADLESS_PRINT_MANAGER_H_
6 #define HEADLESS_LIB_BROWSER_HEADLESS_PRINT_MANAGER_H_ 6 #define HEADLESS_LIB_BROWSER_HEADLESS_PRINT_MANAGER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "components/printing/browser/print_manager.h" 12 #include "components/printing/browser/print_manager.h"
13 #include "content/public/browser/render_frame_host.h" 13 #include "content/public/browser/render_frame_host.h"
14 #include "content/public/browser/web_contents_user_data.h" 14 #include "content/public/browser/web_contents_user_data.h"
15 #include "headless/public/headless_export.h"
15 #include "printing/print_settings.h" 16 #include "printing/print_settings.h"
16 #include "printing/printing_export.h" 17 #include "printing/printing_export.h"
17 18
18 struct PrintHostMsg_DidPrintPage_Params; 19 struct PrintHostMsg_DidPrintPage_Params;
19 struct PrintHostMsg_ScriptedPrint_Params; 20 struct PrintHostMsg_ScriptedPrint_Params;
20 struct PrintMsg_PrintPages_Params; 21 struct PrintMsg_PrintPages_Params;
21 22
22 namespace printing { 23 namespace printing {
23 24
24 struct HeadlessPrintSettings { 25 struct HeadlessPrintSettings {
(...skipping 27 matching lines...) Expand all
52 METAFILE_MAP_ERROR, 53 METAFILE_MAP_ERROR,
53 UNEXPECTED_VALID_MEMORY_HANDLE, 54 UNEXPECTED_VALID_MEMORY_HANDLE,
54 METAFILE_INVALID_HEADER, 55 METAFILE_INVALID_HEADER,
55 METAFILE_GET_DATA_ERROR, 56 METAFILE_GET_DATA_ERROR,
56 SIMULTANEOUS_PRINT_ACTIVE, 57 SIMULTANEOUS_PRINT_ACTIVE,
57 PAGE_RANGE_SYNTAX_ERROR, 58 PAGE_RANGE_SYNTAX_ERROR,
58 PAGE_COUNT_EXCEEDED, 59 PAGE_COUNT_EXCEEDED,
59 }; 60 };
60 61
61 enum PageRangeStatus { 62 enum PageRangeStatus {
62 NO_ERROR, 63 PRINT_NO_ERROR,
63 SYNTAX_ERROR, 64 SYNTAX_ERROR,
64 LIMIT_ERROR, 65 LIMIT_ERROR,
65 }; 66 };
66 67
67 using GetPDFCallback = base::Callback<void(PrintResult, const std::string&)>; 68 using GetPDFCallback = base::Callback<void(PrintResult, const std::string&)>;
68 69
69 ~HeadlessPrintManager() override; 70 ~HeadlessPrintManager() override;
70 71
71 static std::string PrintResultToString(PrintResult result); 72 static std::string PrintResultToString(PrintResult result);
72 static std::unique_ptr<base::DictionaryValue> PDFContentsToDictionaryValue( 73 static std::unique_ptr<base::DictionaryValue> PDFContentsToDictionaryValue(
73 const std::string& data); 74 const std::string& data);
74 static PageRangeStatus PageRangeTextToPages(base::StringPiece page_range_text, 75 // Exported for tests.
75 int pages_count, 76 HEADLESS_EXPORT static PageRangeStatus PageRangeTextToPages(
76 std::vector<int>* pages); 77 base::StringPiece page_range_text,
78 int pages_count,
79 std::vector<int>* pages);
77 80
78 // Prints the current document immediately. Since the rendering is 81 // Prints the current document immediately. Since the rendering is
79 // asynchronous, the actual printing will not be completed on the return of 82 // asynchronous, the actual printing will not be completed on the return of
80 // this function, and |callback| will always get called when printing 83 // this function, and |callback| will always get called when printing
81 // finishes. 84 // finishes.
82 void GetPDFContents(content::RenderFrameHost* rfh, 85 void GetPDFContents(content::RenderFrameHost* rfh,
83 const HeadlessPrintSettings& settings, 86 const HeadlessPrintSettings& settings,
84 const GetPDFCallback& callback); 87 const GetPDFCallback& callback);
85 88
86 private: 89 private:
(...skipping 26 matching lines...) Expand all
113 116
114 // Set to true when OnDidPrintPage() should be expecting the first page. 117 // Set to true when OnDidPrintPage() should be expecting the first page.
115 bool expecting_first_page_; 118 bool expecting_first_page_;
116 119
117 DISALLOW_COPY_AND_ASSIGN(HeadlessPrintManager); 120 DISALLOW_COPY_AND_ASSIGN(HeadlessPrintManager);
118 }; 121 };
119 122
120 } // namespace printing 123 } // namespace printing
121 124
122 #endif // HEADLESS_LIB_BROWSER_HEADLESS_PRINT_MANAGER_H_ 125 #endif // HEADLESS_LIB_BROWSER_HEADLESS_PRINT_MANAGER_H_
OLDNEW
« no previous file with comments | « headless/lib/browser/headless_devtools_manager_delegate.h ('k') | headless/lib/browser/headless_print_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698