| OLD | NEW |
| 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/c/dev/ppb_printing_dev.h" | 5 #include "ppapi/c/dev/ppb_printing_dev.h" |
| 6 #include "ppapi/thunk/enter.h" | 6 #include "ppapi/thunk/enter.h" |
| 7 #include "ppapi/thunk/thunk.h" | 7 #include "ppapi/thunk/thunk.h" |
| 8 | 8 |
| 9 namespace ppapi { | 9 namespace ppapi { |
| 10 namespace thunk { | 10 namespace thunk { |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 PP_Bool GetDefaultPrintSettings(PP_Instance instance, | 14 int32_t GetDefaultPrintSettings(PP_Instance instance, |
| 15 PP_PrintSettings_Dev* print_settings) { | 15 PP_PrintSettings_Dev* print_settings, |
| 16 EnterInstance enter(instance); | 16 PP_CompletionCallback callback) { |
| 17 EnterInstance enter(instance, callback); |
| 17 if (enter.failed()) | 18 if (enter.failed()) |
| 18 return PP_FALSE; | 19 return enter.retval(); |
| 19 return enter.functions()->GetDefaultPrintSettings(instance, print_settings); | 20 return enter.functions()->GetDefaultPrintSettings(instance, print_settings, |
| 21 enter.callback()); |
| 20 } | 22 } |
| 21 | 23 |
| 22 const PPB_Printing_Dev g_ppb_printing_dev_thunk = { | 24 PP_Bool GetDefaultPrintSettings_0_6(PP_Instance instance, |
| 25 PP_PrintSettings_Dev* print_settings) { |
| 26 // TODO(raymes): This is obsolete now. Just return some default settings. |
| 27 // Remove this when all versions of Flash we care about are no longer using |
| 28 // it. |
| 29 PP_PrintSettings_Dev default_settings = { |
| 30 // |printable_area|: all of the sheet of paper. |
| 31 { { 0, 0 }, { 612, 792 } }, |
| 32 // |content_area|: 0.5" margins all around. |
| 33 { { 36, 36 }, { 540, 720 } }, |
| 34 // |paper_size|: 8.5" x 11" (US letter). |
| 35 { 612, 792 }, |
| 36 300, // |dpi|. |
| 37 PP_PRINTORIENTATION_NORMAL, // |orientation|. |
| 38 PP_PRINTSCALINGOPTION_NONE, // |print_scaling_option|. |
| 39 PP_FALSE, // |grayscale|. |
| 40 PP_PRINTOUTPUTFORMAT_PDF // |format|. |
| 41 }; |
| 42 *print_settings = default_settings; |
| 43 return PP_TRUE; |
| 44 } |
| 45 |
| 46 const PPB_Printing_Dev g_ppb_printing_dev_thunk_0_7 = { |
| 23 &GetDefaultPrintSettings, | 47 &GetDefaultPrintSettings, |
| 24 }; | 48 }; |
| 25 | 49 |
| 50 const PPB_Printing_Dev_0_6 g_ppb_printing_dev_thunk_0_6 = { |
| 51 &GetDefaultPrintSettings_0_6, |
| 52 }; |
| 53 |
| 26 } // namespace | 54 } // namespace |
| 27 | 55 |
| 28 const PPB_Printing_Dev_0_6* GetPPB_Printing_Dev_0_6_Thunk() { | 56 const PPB_Printing_Dev_0_6* GetPPB_Printing_Dev_0_6_Thunk() { |
| 29 return &g_ppb_printing_dev_thunk; | 57 return &g_ppb_printing_dev_thunk_0_6; |
| 58 } |
| 59 |
| 60 const PPB_Printing_Dev_0_7* GetPPB_Printing_Dev_0_7_Thunk() { |
| 61 return &g_ppb_printing_dev_thunk_0_7; |
| 30 } | 62 } |
| 31 | 63 |
| 32 } // namespace thunk | 64 } // namespace thunk |
| 33 } // namespace ppapi | 65 } // namespace ppapi |
| OLD | NEW |