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

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

Issue 7718004: ppapi: Make 0.4 the default for PPP_Printing_Dev, leave backwards-compat (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporate NaCl proxy changes Created 9 years, 3 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 #ifdef PPP_PRINTING_DEV_USE_0_4
18 uint32_t QuerySupportedFormats(PP_Instance instance) { 17 uint32_t QuerySupportedFormats(PP_Instance instance) {
19 void* object = 18 void* object =
20 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface); 19 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface);
21 if (!object) 20 if (!object)
22 return 0; 21 return 0;
23 return static_cast<Printing_Dev*>(object)->QuerySupportedPrintOutputFormats(); 22 return static_cast<Printing_Dev*>(object)->QuerySupportedPrintOutputFormats();
24 } 23 }
25 #else
26 PP_PrintOutputFormat_Dev* QuerySupportedFormats(PP_Instance instance,
27 uint32_t* format_count) {
28 void* object =
29 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface);
30 if (!object)
31 return NULL;
32 return static_cast<Printing_Dev*>(object)->QuerySupportedPrintOutputFormats(
33 format_count);
34 }
35 #endif
36 24
37 int32_t Begin(PP_Instance instance, 25 int32_t Begin(PP_Instance instance,
38 const struct PP_PrintSettings_Dev* print_settings) { 26 const struct PP_PrintSettings_Dev* print_settings) {
39 void* object = 27 void* object =
40 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface); 28 pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface);
41 if (!object) 29 if (!object)
42 return 0; 30 return 0;
43 return static_cast<Printing_Dev*>(object)->PrintBegin(*print_settings); 31 return static_cast<Printing_Dev*>(object)->PrintBegin(*print_settings);
44 } 32 }
45 33
(...skipping 28 matching lines...) Expand all
74 : associated_instance_(instance) { 62 : associated_instance_(instance) {
75 pp::Module::Get()->AddPluginInterface(kPPPPrintingInterface, &ppp_printing); 63 pp::Module::Get()->AddPluginInterface(kPPPPrintingInterface, &ppp_printing);
76 associated_instance_->AddPerInstanceObject(kPPPPrintingInterface, this); 64 associated_instance_->AddPerInstanceObject(kPPPPrintingInterface, this);
77 } 65 }
78 66
79 Printing_Dev::~Printing_Dev() { 67 Printing_Dev::~Printing_Dev() {
80 associated_instance_->RemovePerInstanceObject(kPPPPrintingInterface, this); 68 associated_instance_->RemovePerInstanceObject(kPPPPrintingInterface, this);
81 } 69 }
82 70
83 } // namespace pp 71 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/printing_dev.h ('k') | ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_printing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698