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

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

Issue 8041052: Add IsScalingDisabled and PP_PRINTOUTPUTFORMAT_EMF to pepper printing interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
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
11 namespace pp { 11 namespace pp {
12 12
13 namespace { 13 namespace {
14 14
15 static const char kPPPPrintingInterface[] = PPP_PRINTING_DEV_INTERFACE; 15 static const char kPPPPrintingInterface[] = PPP_PRINTING_DEV_INTERFACE;
16 16
17 uint32_t QuerySupportedFormats(PP_Instance instance) { 17 uint32_t QuerySupportedFormats(PP_Instance instance) {
18 void* object = 18 void* object =
19 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface); 19 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface);
20 if (!object) 20 if (!object)
21 return 0; 21 return 0;
22 return static_cast<Printing_Dev*>(object)->QuerySupportedPrintOutputFormats(); 22 return static_cast<Printing_Dev*>(object)->QuerySupportedPrintOutputFormats();
23 } 23 }
24 24
25 bool IsScalingDisabled(PP_Instance instance) {
26 void* object =
27 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface);
28 if (!object)
29 return 0;
dmichael (off chromium) 2011/09/27 15:28:38 0->false?
vandebo (ex-Chrome) 2011/09/27 20:02:24 Done.
30 return static_cast<Printing_Dev*>(object)->IsPrintScalingDisabled();
31 }
32
25 int32_t Begin(PP_Instance instance, 33 int32_t Begin(PP_Instance instance,
26 const struct PP_PrintSettings_Dev* print_settings) { 34 const struct PP_PrintSettings_Dev* print_settings) {
27 void* object = 35 void* object =
28 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface); 36 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface);
29 if (!object) 37 if (!object)
30 return 0; 38 return 0;
31 return static_cast<Printing_Dev*>(object)->PrintBegin(*print_settings); 39 return static_cast<Printing_Dev*>(object)->PrintBegin(*print_settings);
32 } 40 }
33 41
34 PP_Resource PrintPages(PP_Instance instance, 42 PP_Resource PrintPages(PP_Instance instance,
35 const struct PP_PrintPageNumberRange_Dev* page_ranges, 43 const struct PP_PrintPageNumberRange_Dev* page_ranges,
36 uint32_t page_range_count) { 44 uint32_t page_range_count) {
37 void* object = 45 void* object =
38 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface); 46 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface);
39 if (!object) 47 if (!object)
40 return 0; 48 return 0;
41 return static_cast<Printing_Dev*>(object)->PrintPages( 49 return static_cast<Printing_Dev*>(object)->PrintPages(
42 page_ranges, page_range_count).detach(); 50 page_ranges, page_range_count).detach();
43 } 51 }
44 52
45 void End(PP_Instance instance) { 53 void End(PP_Instance instance) {
46 void* object = 54 void* object =
47 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface); 55 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface);
48 if (object) 56 if (object)
49 static_cast<Printing_Dev*>(object)->PrintEnd(); 57 static_cast<Printing_Dev*>(object)->PrintEnd();
50 } 58 }
51 59
52 const PPP_Printing_Dev ppp_printing = { 60 const PPP_Printing_Dev ppp_printing = {
53 &QuerySupportedFormats, 61 &QuerySupportedFormats,
62 &IsScalingDisabled,
54 &Begin, 63 &Begin,
55 &PrintPages, 64 &PrintPages,
56 &End 65 &End
57 }; 66 };
58 67
59 } // namespace 68 } // namespace
60 69
61 Printing_Dev::Printing_Dev(Instance* instance) 70 Printing_Dev::Printing_Dev(Instance* instance)
62 : associated_instance_(instance) { 71 : associated_instance_(instance) {
63 pp::Module::Get()->AddPluginInterface(kPPPPrintingInterface, &ppp_printing); 72 pp::Module::Get()->AddPluginInterface(kPPPPrintingInterface, &ppp_printing);
64 associated_instance_->AddPerInstanceObject(kPPPPrintingInterface, this); 73 associated_instance_->AddPerInstanceObject(kPPPPrintingInterface, this);
65 } 74 }
66 75
67 Printing_Dev::~Printing_Dev() { 76 Printing_Dev::~Printing_Dev() {
68 associated_instance_->RemovePerInstanceObject(kPPPPrintingInterface, this); 77 associated_instance_->RemovePerInstanceObject(kPPPPrintingInterface, this);
69 } 78 }
70 79
71 } // namespace pp 80 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698