OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROME_BROWSER_PRINTING_PDF_TO_EMF_CONVERTER_H_ | 5 #ifndef CHROME_BROWSER_PRINTING_PDF_TO_EMF_CONVERTER_H_ |
6 #define CHROME_BROWSER_PRINTING_PDF_TO_EMF_CONVERTER_H_ | 6 #define CHROME_BROWSER_PRINTING_PDF_TO_EMF_CONVERTER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/ref_counted_memory.h" | 11 #include "base/memory/ref_counted_memory.h" |
12 | 12 |
13 namespace printing { | 13 namespace printing { |
14 | 14 |
15 class MetafilePlayer; | 15 class MetafilePlayer; |
16 struct PdfRenderSettings; | 16 struct PdfRenderSettings; |
17 | 17 |
18 class PdfToEmfConverter { | 18 class PdfToEmfConverter { |
19 public: | 19 public: |
Vitaly Buka (NO REVIEWS)
2017/01/17 19:29:16
I'd recommend to submit patches as small as possib
| |
20 typedef base::Callback<void(int page_count)> StartCallback; | 20 using StartCallback = base::Callback<void(int page_count)>; |
21 typedef base::Callback<void(int page_number, | 21 using GetPageCallback = |
22 float scale_factor, | 22 base::Callback<void(int page_number, |
23 std::unique_ptr<MetafilePlayer> emf)> | 23 float scale_factor, |
24 GetPageCallback; | 24 std::unique_ptr<MetafilePlayer> emf)>; |
25 | 25 |
26 virtual ~PdfToEmfConverter(); | 26 virtual ~PdfToEmfConverter(); |
27 | 27 |
28 static std::unique_ptr<PdfToEmfConverter> CreateDefault(); | 28 static std::unique_ptr<PdfToEmfConverter> CreateDefault(); |
29 | 29 |
30 // Starts conversion of PDF provided as |data|. Calls |start_callback| | 30 // Starts conversion of PDF provided as |data|. Calls |start_callback| |
31 // with positive |page_count|. |page_count| is 0 if initialization failed. | 31 // with positive |page_count|. |page_count| is 0 if initialization failed. |
32 virtual void Start(const scoped_refptr<base::RefCountedMemory>& data, | 32 virtual void Start(const scoped_refptr<base::RefCountedMemory>& data, |
33 const PdfRenderSettings& conversion_settings, | 33 const PdfRenderSettings& conversion_settings, |
34 bool print_text_with_gdi, | |
35 const StartCallback& start_callback) = 0; | 34 const StartCallback& start_callback) = 0; |
36 | 35 |
37 // Requests conversion of the page. |page_number| is 0-base page number in | 36 // Requests conversion of the page. |page_number| is 0-base page number in |
37 // PDF provided in Start() call. | |
38 // Calls |get_page_callback| after conversion. |emf| of callback in not NULL | |
39 // if conversion succeeded. | |
40 virtual void GetPage(int page_number, | |
41 const GetPageCallback& get_page_callback) = 0; | |
42 }; | |
43 | |
44 class PdfToPostScriptConverter { | |
Vitaly Buka (NO REVIEWS)
2017/01/17 19:29:16
why not separate pair of h/cc file
git probably wo
| |
45 public: | |
46 using StartCallback = base::Callback<void(int page_count)>; | |
47 using GetPageCallback = | |
48 base::Callback<void(int page_number, | |
49 std::unique_ptr<MetafilePlayer> ps_metafile)>; | |
50 | |
51 virtual ~PdfToPostScriptConverter(); | |
52 | |
53 static std::unique_ptr<PdfToPostScriptConverter> CreateDefault(); | |
54 | |
55 // Starts conversion of PDF provided as |data|. Calls |start_callback| | |
56 // with positive |page_count|. |page_count| is 0 if initialization failed. | |
57 virtual void Start(const scoped_refptr<base::RefCountedMemory>& data, | |
58 const PdfRenderSettings& conversion_settings, | |
59 const StartCallback& start_callback) = 0; | |
60 | |
61 // Requests conversion of the page. |page_number| is 0-base page number in | |
38 // PDF provided in Start() call. | 62 // PDF provided in Start() call. |
39 // Calls |get_page_callback| after conversion. |emf| of callback in not NULL | 63 // Calls |get_page_callback| after conversion. |emf| of callback in not NULL |
40 // if conversion succeeded. | 64 // if conversion succeeded. |
41 virtual void GetPage(int page_number, | 65 virtual void GetPage(int page_number, |
42 const GetPageCallback& get_page_callback) = 0; | 66 const GetPageCallback& get_page_callback) = 0; |
43 }; | 67 }; |
44 | 68 |
45 } // namespace printing | 69 } // namespace printing |
46 | 70 |
47 #endif // CHROME_BROWSER_PRINTING_PDF_TO_EMF_CONVERTER_H_ | 71 #endif // CHROME_BROWSER_PRINTING_PDF_TO_EMF_CONVERTER_H_ |
OLD | NEW |