Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: ppapi/cpp/dev/printing_dev.cc

Issue 375253002: [Chrome] Support NumCopies print preset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback (update method name) Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "ppapi/cpp/dev/printing_dev.h" 5 #include "ppapi/cpp/dev/printing_dev.h"
6 6
7 #include "ppapi/c/dev/ppb_printing_dev.h" 7 #include "ppapi/c/dev/ppb_printing_dev.h"
8 #include "ppapi/cpp/instance.h" 8 #include "ppapi/cpp/instance.h"
9 #include "ppapi/cpp/instance_handle.h" 9 #include "ppapi/cpp/instance_handle.h"
10 #include "ppapi/cpp/module.h" 10 #include "ppapi/cpp/module.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 PP_Bool IsScalingDisabled(PP_Instance instance) { 58 PP_Bool IsScalingDisabled(PP_Instance instance) {
59 void* object = 59 void* object =
60 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface); 60 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface);
61 if (!object) 61 if (!object)
62 return PP_FALSE; 62 return PP_FALSE;
63 bool return_value = 63 bool return_value =
64 static_cast<Printing_Dev*>(object)->IsPrintScalingDisabled(); 64 static_cast<Printing_Dev*>(object)->IsPrintScalingDisabled();
65 return PP_FromBool(return_value); 65 return PP_FromBool(return_value);
66 } 66 }
67 67
68 int32_t GetCopiesToPrint(PP_Instance instance) {
69 void* object =
70 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface);
71 if (!object)
72 return 1;
73 return static_cast<Printing_Dev*>(object)->GetCopiesToPrint();
74 }
75
68 const PPP_Printing_Dev ppp_printing = { 76 const PPP_Printing_Dev ppp_printing = {
69 &QuerySupportedFormats, 77 &QuerySupportedFormats, &Begin, &PrintPages,
70 &Begin, 78 &End, &IsScalingDisabled, &GetCopiesToPrint};
71 &PrintPages,
72 &End,
73 &IsScalingDisabled
74 };
75 79
76 } // namespace 80 } // namespace
77 81
78 Printing_Dev::Printing_Dev(Instance* instance) 82 Printing_Dev::Printing_Dev(Instance* instance)
79 : associated_instance_(instance) { 83 : associated_instance_(instance) {
80 Module::Get()->AddPluginInterface(kPPPPrintingInterface, &ppp_printing); 84 Module::Get()->AddPluginInterface(kPPPPrintingInterface, &ppp_printing);
81 instance->AddPerInstanceObject( 85 instance->AddPerInstanceObject(
82 kPPPPrintingInterface, this); 86 kPPPPrintingInterface, this);
83 if (has_interface<PPB_Printing_Dev_0_7>()) { 87 if (has_interface<PPB_Printing_Dev_0_7>()) {
84 PassRefFromConstructor(get_interface<PPB_Printing_Dev_0_7>()->Create( 88 PassRefFromConstructor(get_interface<PPB_Printing_Dev_0_7>()->Create(
(...skipping 14 matching lines...) Expand all
99 int32_t Printing_Dev::GetDefaultPrintSettings( 103 int32_t Printing_Dev::GetDefaultPrintSettings(
100 const CompletionCallbackWithOutput<PP_PrintSettings_Dev>& callback) const { 104 const CompletionCallbackWithOutput<PP_PrintSettings_Dev>& callback) const {
101 if (has_interface<PPB_Printing_Dev_0_7>()) { 105 if (has_interface<PPB_Printing_Dev_0_7>()) {
102 return get_interface<PPB_Printing_Dev_0_7>()->GetDefaultPrintSettings( 106 return get_interface<PPB_Printing_Dev_0_7>()->GetDefaultPrintSettings(
103 pp_resource(), callback.output(), callback.pp_completion_callback()); 107 pp_resource(), callback.output(), callback.pp_completion_callback());
104 } 108 }
105 return callback.MayForce(PP_ERROR_NOINTERFACE); 109 return callback.MayForce(PP_ERROR_NOINTERFACE);
106 } 110 }
107 111
108 } // namespace pp 112 } // namespace pp
OLDNEW
« ppapi/api/dev/ppp_printing_dev.idl ('K') | « ppapi/cpp/dev/printing_dev.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698