Revert 168224 - Update V8 to version 3.15.4.
[chromium-blink-merge.git] / ppapi / thunk / ppb_printing_thunk.cc
blob2fc34e35de537981aa51ecee47fcc6f7c82003e1
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.
5 #include "ppapi/c/dev/pp_print_settings_dev.h"
6 #include "ppapi/c/dev/ppb_printing_dev.h"
7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/thunk/enter.h"
10 #include "ppapi/thunk/ppb_printing_api.h"
11 #include "ppapi/thunk/resource_creation_api.h"
12 #include "ppapi/thunk/thunk.h"
14 namespace ppapi {
15 namespace thunk {
17 namespace {
19 PP_Bool GetDefaultPrintSettings_0_6(PP_Instance instance,
20 PP_PrintSettings_Dev* print_settings) {
21 // TODO(raymes): This is obsolete now. Just return some default settings.
22 // Remove this when all versions of Flash we care about are no longer using
23 // it.
24 PP_PrintSettings_Dev default_settings = {
25 // |printable_area|: all of the sheet of paper.
26 { { 0, 0 }, { 612, 792 } },
27 // |content_area|: 0.5" margins all around.
28 { { 36, 36 }, { 540, 720 } },
29 // |paper_size|: 8.5" x 11" (US letter).
30 { 612, 792 },
31 300, // |dpi|.
32 PP_PRINTORIENTATION_NORMAL, // |orientation|.
33 PP_PRINTSCALINGOPTION_NONE, // |print_scaling_option|.
34 PP_FALSE, // |grayscale|.
35 PP_PRINTOUTPUTFORMAT_PDF // |format|.
37 *print_settings = default_settings;
38 return PP_TRUE;
41 PP_Resource Create(PP_Instance instance) {
42 EnterResourceCreation enter(instance);
43 if (enter.failed())
44 return 0;
45 return enter.functions()->CreatePrinting(instance);
48 int32_t GetDefaultPrintSettings(PP_Resource resource,
49 PP_PrintSettings_Dev* print_settings,
50 PP_CompletionCallback callback) {
51 EnterResource<PPB_Printing_API> enter(resource, callback, true);
52 if (enter.failed())
53 return enter.retval();
54 return enter.SetResult(
55 enter.object()->GetDefaultPrintSettings(print_settings,
56 enter.callback()));
59 const PPB_Printing_Dev_0_6 g_ppb_printing_dev_thunk_0_6 = {
60 &GetDefaultPrintSettings_0_6,
63 const PPB_Printing_Dev g_ppb_printing_dev_thunk_0_7 = {
64 &Create,
65 &GetDefaultPrintSettings,
68 } // namespace
70 const PPB_Printing_Dev_0_6* GetPPB_Printing_Dev_0_6_Thunk() {
71 return &g_ppb_printing_dev_thunk_0_6;
74 const PPB_Printing_Dev_0_7* GetPPB_Printing_Dev_0_7_Thunk() {
75 return &g_ppb_printing_dev_thunk_0_7;
78 } // namespace thunk
79 } // namespace ppapi