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 "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 class FilePath; | 13 class FilePath; |
14 } | 14 } |
15 | 15 |
16 namespace printing { | 16 namespace printing { |
17 | 17 |
18 class MetafilePlayer; | 18 class MetafilePlayer; |
19 class PdfRenderSettings; | 19 class PdfRenderSettings; |
20 | 20 |
21 class PdfToEmfConverter { | 21 class PdfToEmfConverter { |
22 public: | 22 public: |
23 typedef base::Callback<void(int page_count)> StartCallback; | 23 typedef base::Callback<void(int page_count)> StartCallback; |
24 typedef base::Callback<void(int page_number, | 24 typedef base::Callback<void(int page_number, |
25 double scale_factor, | 25 float scale_factor, |
26 scoped_ptr<MetafilePlayer> emf)> GetPageCallback; | 26 scoped_ptr<MetafilePlayer> emf)> GetPageCallback; |
27 | 27 |
28 virtual ~PdfToEmfConverter(); | 28 virtual ~PdfToEmfConverter(); |
29 | 29 |
30 static scoped_ptr<PdfToEmfConverter> CreateDefault(); | 30 static scoped_ptr<PdfToEmfConverter> CreateDefault(); |
31 | 31 |
32 // Starts conversion of PDF provided as |data|. Calls |start_callback| | 32 // Starts conversion of PDF provided as |data|. Calls |start_callback| |
33 // with positive |page_count|. |page_count| is 0 if initialization failed. | 33 // with positive |page_count|. |page_count| is 0 if initialization failed. |
34 virtual void Start(const scoped_refptr<base::RefCountedMemory>& data, | 34 virtual void Start(const scoped_refptr<base::RefCountedMemory>& data, |
35 const PdfRenderSettings& conversion_settings, | 35 const PdfRenderSettings& conversion_settings, |
36 const StartCallback& start_callback) = 0; | 36 const StartCallback& start_callback) = 0; |
37 | 37 |
38 // Requests conversion of the page. |page_number| is 0-base page number in | 38 // Requests conversion of the page. |page_number| is 0-base page number in |
39 // PDF provided in Start() call. | 39 // PDF provided in Start() call. |
40 // Calls |get_page_callback| after conversion. |emf| of callback in not NULL | 40 // Calls |get_page_callback| after conversion. |emf| of callback in not NULL |
41 // if conversion succeeded. | 41 // if conversion succeeded. |
42 virtual void GetPage(int page_number, | 42 virtual void GetPage(int page_number, |
43 const GetPageCallback& get_page_callback) = 0; | 43 const GetPageCallback& get_page_callback) = 0; |
44 }; | 44 }; |
45 | 45 |
46 } // namespace printing | 46 } // namespace printing |
47 | 47 |
48 #endif // CHROME_BROWSER_PRINTING_PDF_TO_EMF_CONVERTER_H_ | 48 #endif // CHROME_BROWSER_PRINTING_PDF_TO_EMF_CONVERTER_H_ |
OLD | NEW |