Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "native_client/src/shared/ppapi_proxy/browser_ppp_printing.h" | 5 #include "native_client/src/shared/ppapi_proxy/browser_ppp_printing.h" |
| 6 | 6 |
| 7 #include "native_client/src/include/portability.h" | 7 #include "native_client/src/include/portability.h" |
| 8 #include "native_client/src/shared/ppapi_proxy/browser_globals.h" | 8 #include "native_client/src/shared/ppapi_proxy/browser_globals.h" |
| 9 #include "native_client/src/shared/ppapi_proxy/browser_ppp.h" | 9 #include "native_client/src/shared/ppapi_proxy/browser_ppp.h" |
| 10 #include "native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h" | 10 #include "native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 GetMainSrpcChannel(instance), | 31 GetMainSrpcChannel(instance), |
| 32 instance, | 32 instance, |
| 33 &formats); | 33 &formats); |
| 34 | 34 |
| 35 DebugPrintf("PPP_Printing_Dev::QuerySupportedFormats: %s\n", | 35 DebugPrintf("PPP_Printing_Dev::QuerySupportedFormats: %s\n", |
| 36 NaClSrpcErrorString(srpc_result)); | 36 NaClSrpcErrorString(srpc_result)); |
| 37 | 37 |
| 38 return static_cast<uint32_t>(formats); | 38 return static_cast<uint32_t>(formats); |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool IsScalingDisabled(PP_Instance instance) { | |
| 42 DebugPrintf("PPP_Printing_Dev::IsScalingDisabled: " | |
| 43 "instance=%"NACL_PRIu32"\n", instance); | |
| 44 | |
| 45 bool result = false; | |
| 46 NaClSrpcError srpc_result = | |
| 47 PppPrintingRpcClient::PPP_Printing_IsScalingDisabled( | |
| 48 GetMainSrpcChannel(instance), | |
| 49 instance, | |
| 50 &result); | |
| 51 | |
| 52 DebugPrintf("PPP_Printing_Dev::IsScalingDisabled: %s\n", | |
| 53 NaClSrpcErrorString(srpc_result)); | |
| 54 | |
| 55 return result; | |
| 56 } | |
| 57 | |
| 58 | |
| 41 int32_t Begin(PP_Instance instance, | 59 int32_t Begin(PP_Instance instance, |
| 42 const struct PP_PrintSettings_Dev* print_settings) { | 60 const struct PP_PrintSettings_Dev* print_settings) { |
| 43 DebugPrintf("PPP_Printing_Dev::Begin: instance=%"NACL_PRIu32"\n", instance); | 61 DebugPrintf("PPP_Printing_Dev::Begin: instance=%"NACL_PRIu32"\n", instance); |
| 44 | 62 |
| 45 int32_t pages_required = 0; | 63 int32_t pages_required = 0; |
| 46 NaClSrpcError srpc_result = | 64 NaClSrpcError srpc_result = |
| 47 PppPrintingRpcClient::PPP_Printing_Begin( | 65 PppPrintingRpcClient::PPP_Printing_Begin( |
| 48 GetMainSrpcChannel(instance), | 66 GetMainSrpcChannel(instance), |
| 49 instance, | 67 instance, |
| 50 kPPPrintSettingsBytes, | 68 kPPPrintSettingsBytes, |
| 51 reinterpret_cast<char*>( | 69 reinterpret_cast<char*>( |
| 52 const_cast<PP_PrintSettings_Dev*>(print_settings)), | 70 const_cast<PP_PrintSettings_Dev*>(print_settings)), |
| 53 &pages_required); | 71 &pages_required); |
| 54 | 72 |
| 55 DebugPrintf("PPP_Printing_Dev::QuerySupportedFormats: %s\n", | 73 DebugPrintf("PPP_Printing_Dev::Begin: %s\n", |
| 56 NaClSrpcErrorString(srpc_result)); | 74 NaClSrpcErrorString(srpc_result)); |
| 57 return pages_required; | 75 return pages_required; |
| 58 } | 76 } |
| 59 | 77 |
| 60 PP_Resource PrintPages(PP_Instance instance, | 78 PP_Resource PrintPages(PP_Instance instance, |
| 61 const struct PP_PrintPageNumberRange_Dev* page_ranges, | 79 const struct PP_PrintPageNumberRange_Dev* page_ranges, |
| 62 uint32_t page_range_count) { | 80 uint32_t page_range_count) { |
| 63 DebugPrintf("PPP_Printing_Dev::PrintPages: " | 81 DebugPrintf("PPP_Printing_Dev::PrintPages: " |
| 64 "instance=%"NACL_PRIu32"\n", instance); | 82 "instance=%"NACL_PRIu32"\n", instance); |
| 65 | 83 |
| 66 PP_Resource image_data = kInvalidResourceId; | 84 PP_Resource image_data = kInvalidResourceId; |
| 67 NaClSrpcError srpc_result = | 85 NaClSrpcError srpc_result = |
| 68 PppPrintingRpcClient::PPP_Printing_PrintPages( | 86 PppPrintingRpcClient::PPP_Printing_PrintPages( |
| 69 GetMainSrpcChannel(instance), | 87 GetMainSrpcChannel(instance), |
| 70 instance, | 88 instance, |
| 71 page_range_count * kPPPrintPageNumberRangeBytes, | 89 page_range_count * kPPPrintPageNumberRangeBytes, |
| 72 reinterpret_cast<char*>( | 90 reinterpret_cast<char*>( |
| 73 const_cast<PP_PrintPageNumberRange_Dev*>(page_ranges)), | 91 const_cast<PP_PrintPageNumberRange_Dev*>(page_ranges)), |
| 74 page_range_count, | 92 page_range_count, |
| 75 &image_data); | 93 &image_data); |
| 76 | 94 |
| 77 DebugPrintf("PPP_Printing_Dev::QuerySupportedFormats: %s\n", | 95 DebugPrintf("PPP_Printing_Dev::PrintPages: %s\n", |
|
dmichael (off chromium)
2011/09/27 15:28:38
nice catch, thanks!
| |
| 78 NaClSrpcErrorString(srpc_result)); | 96 NaClSrpcErrorString(srpc_result)); |
| 79 return image_data; | 97 return image_data; |
| 80 } | 98 } |
| 81 | 99 |
| 82 void End(PP_Instance instance) { | 100 void End(PP_Instance instance) { |
| 83 DebugPrintf("PPP_Printing_Dev::End: instance=%"NACL_PRIu32"\n", instance); | 101 DebugPrintf("PPP_Printing_Dev::End: instance=%"NACL_PRIu32"\n", instance); |
| 84 | 102 |
| 85 NaClSrpcError srpc_result = | 103 NaClSrpcError srpc_result = |
| 86 PppPrintingRpcClient::PPP_Printing_End(GetMainSrpcChannel(instance), | 104 PppPrintingRpcClient::PPP_Printing_End(GetMainSrpcChannel(instance), |
| 87 instance); | 105 instance); |
| 88 | 106 |
| 89 DebugPrintf("PPP_Printing_Dev::End: %s\n", NaClSrpcErrorString(srpc_result)); | 107 DebugPrintf("PPP_Printing_Dev::End: %s\n", NaClSrpcErrorString(srpc_result)); |
| 90 } | 108 } |
| 91 | 109 |
| 92 } // namespace | 110 } // namespace |
| 93 | 111 |
| 94 const PPP_Printing_Dev* BrowserPrinting::GetInterface() { | 112 const PPP_Printing_Dev* BrowserPrinting::GetInterface() { |
| 95 static const PPP_Printing_Dev printing_interface = { | 113 static const PPP_Printing_Dev printing_interface = { |
| 96 QuerySupportedFormats, | 114 QuerySupportedFormats, |
| 115 IsScalingDisabled, | |
| 97 Begin, | 116 Begin, |
| 98 PrintPages, | 117 PrintPages, |
| 99 End | 118 End |
| 100 }; | 119 }; |
| 101 return &printing_interface; | 120 return &printing_interface; |
| 102 } | 121 } |
| 103 | 122 |
| 104 } // namespace ppapi_proxy | 123 } // namespace ppapi_proxy |
| 105 | 124 |
| OLD | NEW |