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