OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 PPAPI_CPP_DEV_PRINTING_DEV_H_ | 5 #ifndef PPAPI_CPP_DEV_PRINTING_DEV_H_ |
6 #define PPAPI_CPP_DEV_PRINTING_DEV_H_ | 6 #define PPAPI_CPP_DEV_PRINTING_DEV_H_ |
7 | 7 |
8 #include "ppapi/c/dev/ppp_printing_dev.h" | 8 #include "ppapi/c/dev/ppp_printing_dev.h" |
| 9 #include "ppapi/cpp/completion_callback.h" |
9 #include "ppapi/cpp/instance_handle.h" | 10 #include "ppapi/cpp/instance_handle.h" |
10 #include "ppapi/cpp/resource.h" | 11 #include "ppapi/cpp/resource.h" |
11 | 12 |
12 namespace pp { | 13 namespace pp { |
13 | 14 |
14 class Instance; | 15 class Instance; |
15 | 16 |
16 // You would typically use this either via inheritance on your instance or | 17 // You would typically use this either via inheritance on your instance or |
17 // by composition: see find_dev.h for an example. | 18 // by composition: see find_dev.h for an example. |
18 class Printing_Dev { | 19 class Printing_Dev : public Resource { |
19 public: | 20 public: |
20 // The instance parameter must outlive this class. | 21 // The instance parameter must outlive this class. |
21 explicit Printing_Dev(Instance* instance); | 22 explicit Printing_Dev(Instance* instance); |
22 virtual ~Printing_Dev(); | 23 virtual ~Printing_Dev(); |
23 | 24 |
24 // PPP_Printing_Dev functions exposed as virtual functions for you to | 25 // PPP_Printing_Dev functions exposed as virtual functions for you to |
25 // override. | 26 // override. |
26 virtual uint32_t QuerySupportedPrintOutputFormats() = 0; | 27 virtual uint32_t QuerySupportedPrintOutputFormats() = 0; |
27 virtual int32_t PrintBegin(const PP_PrintSettings_Dev& print_settings) = 0; | 28 virtual int32_t PrintBegin(const PP_PrintSettings_Dev& print_settings) = 0; |
28 virtual Resource PrintPages(const PP_PrintPageNumberRange_Dev* page_ranges, | 29 virtual Resource PrintPages(const PP_PrintPageNumberRange_Dev* page_ranges, |
29 uint32_t page_range_count) = 0; | 30 uint32_t page_range_count) = 0; |
30 virtual void PrintEnd() = 0; | 31 virtual void PrintEnd() = 0; |
31 virtual bool IsPrintScalingDisabled() = 0; | 32 virtual bool IsPrintScalingDisabled() = 0; |
32 | 33 |
33 // PPB_Printing_Dev functions. | 34 // PPB_Printing_Dev functions. |
34 // Returns true if the browser supports the required PPB_Printing_Dev | 35 // Returns true if the browser supports the required PPB_Printing_Dev |
35 // interface. | 36 // interface. |
36 static bool IsAvailable(); | 37 static bool IsAvailable(); |
37 | 38 |
38 // Outputs the default print settings for the default printer into | 39 // Get the default print settings and store them in the output of |callback|. |
39 // |print_settings|. Returns false on error. | 40 // This method always runs asynchronously and the callback will always be |
40 bool GetDefaultPrintSettings(PP_PrintSettings_Dev* print_settings) const; | 41 // triggered. |
| 42 void GetDefaultPrintSettings( |
| 43 const CompletionCallbackWithOutput<PP_PrintSettings_Dev>& callback) const; |
41 | 44 |
42 private: | 45 private: |
43 InstanceHandle associated_instance_; | 46 InstanceHandle associated_instance_; |
44 }; | 47 }; |
45 | 48 |
46 } // namespace pp | 49 } // namespace pp |
47 | 50 |
48 #endif // PPAPI_CPP_DEV_PRINTING_DEV_H_ | 51 #endif // PPAPI_CPP_DEV_PRINTING_DEV_H_ |
OLD | NEW |