OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ppapi/cpp/dev/printing_dev.h" | 5 #include "ppapi/cpp/dev/printing_dev.h" |
6 | 6 |
7 #include "ppapi/cpp/instance.h" | 7 #include "ppapi/cpp/instance.h" |
8 #include "ppapi/cpp/module.h" | 8 #include "ppapi/cpp/module.h" |
9 #include "ppapi/cpp/module_impl.h" | 9 #include "ppapi/cpp/module_impl.h" |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 page_ranges, page_range_count).detach(); | 42 page_ranges, page_range_count).detach(); |
43 } | 43 } |
44 | 44 |
45 void End(PP_Instance instance) { | 45 void End(PP_Instance instance) { |
46 void* object = | 46 void* object = |
47 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface); | 47 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface); |
48 if (object) | 48 if (object) |
49 static_cast<Printing_Dev*>(object)->PrintEnd(); | 49 static_cast<Printing_Dev*>(object)->PrintEnd(); |
50 } | 50 } |
51 | 51 |
| 52 PP_Bool IsScalingDisabled(PP_Instance instance) { |
| 53 void* object = |
| 54 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface); |
| 55 if (!object) |
| 56 return PP_FALSE; |
| 57 bool return_value = |
| 58 static_cast<Printing_Dev*>(object)->IsPrintScalingDisabled(); |
| 59 return PP_FromBool(return_value); |
| 60 } |
| 61 |
52 const PPP_Printing_Dev ppp_printing = { | 62 const PPP_Printing_Dev ppp_printing = { |
53 &QuerySupportedFormats, | 63 &QuerySupportedFormats, |
54 &Begin, | 64 &Begin, |
55 &PrintPages, | 65 &PrintPages, |
56 &End | 66 &End, |
| 67 &IsScalingDisabled |
57 }; | 68 }; |
58 | 69 |
59 } // namespace | 70 } // namespace |
60 | 71 |
61 Printing_Dev::Printing_Dev(Instance* instance) | 72 Printing_Dev::Printing_Dev(Instance* instance) |
62 : associated_instance_(instance) { | 73 : associated_instance_(instance) { |
63 pp::Module::Get()->AddPluginInterface(kPPPPrintingInterface, &ppp_printing); | 74 pp::Module::Get()->AddPluginInterface(kPPPPrintingInterface, &ppp_printing); |
64 associated_instance_->AddPerInstanceObject(kPPPPrintingInterface, this); | 75 associated_instance_->AddPerInstanceObject(kPPPPrintingInterface, this); |
65 } | 76 } |
66 | 77 |
67 Printing_Dev::~Printing_Dev() { | 78 Printing_Dev::~Printing_Dev() { |
68 associated_instance_->RemovePerInstanceObject(kPPPPrintingInterface, this); | 79 associated_instance_->RemovePerInstanceObject(kPPPPrintingInterface, this); |
69 } | 80 } |
70 | 81 |
71 } // namespace pp | 82 } // namespace pp |
OLD | NEW |