| OLD | NEW |
| 1 // Copyright (c) 2011 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 "native_client/src/shared/ppapi_proxy/plugin_ppb_pdf.h" | 5 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_pdf.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <sys/mman.h> | 10 #include <sys/mman.h> |
| 11 | 11 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 31 const int32_t kMaxFindResults = | 31 const int32_t kMaxFindResults = |
| 32 kMaxFindResultsBytes / kPpbPrivateFindResultBytes; | 32 kMaxFindResultsBytes / kPpbPrivateFindResultBytes; |
| 33 | 33 |
| 34 PP_Var GetLocalizedString( | 34 PP_Var GetLocalizedString( |
| 35 PP_Instance instance, | 35 PP_Instance instance, |
| 36 PP_ResourceString string_id) { | 36 PP_ResourceString string_id) { |
| 37 DebugPrintf("PPB_PDF::GetLocalizedString: " | 37 DebugPrintf("PPB_PDF::GetLocalizedString: " |
| 38 "instance=%"NACL_PRIu32"\n", instance); | 38 "instance=%"NACL_PRIu32"\n", instance); |
| 39 | 39 |
| 40 NaClSrpcChannel* channel = GetMainSrpcChannel(); | 40 NaClSrpcChannel* channel = GetMainSrpcChannel(); |
| 41 nacl_abi_size_t string_size = kMaxVarSize; | 41 nacl_abi_size_t string_size = kMaxReturnVarSize; |
| 42 nacl::scoped_array<char> string_bytes(new char[kMaxVarSize]); | 42 nacl::scoped_array<char> string_bytes(new char[string_size]); |
| 43 NaClSrpcError srpc_result = | 43 NaClSrpcError srpc_result = |
| 44 PpbPdfRpcClient::PPB_PDF_GetLocalizedString( | 44 PpbPdfRpcClient::PPB_PDF_GetLocalizedString( |
| 45 channel, | 45 channel, |
| 46 instance, | 46 instance, |
| 47 static_cast<int32_t>(string_id), | 47 static_cast<int32_t>(string_id), |
| 48 &string_size, string_bytes.get()); | 48 &string_size, string_bytes.get()); |
| 49 | 49 |
| 50 PP_Var string = PP_MakeUndefined(); | 50 PP_Var string = PP_MakeUndefined(); |
| 51 if (srpc_result == NACL_SRPC_RESULT_OK) { | 51 if (srpc_result == NACL_SRPC_RESULT_OK) { |
| 52 (void) DeserializeTo(string_bytes.get(), string_size, 1, &string); | 52 (void) DeserializeTo(string_bytes.get(), string_size, 1, &string); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 PpbPdfRpcClient::PPB_PDF_HistogramPDFPageCount(GetMainSrpcChannel(), | 189 PpbPdfRpcClient::PPB_PDF_HistogramPDFPageCount(GetMainSrpcChannel(), |
| 190 count); | 190 count); |
| 191 | 191 |
| 192 DebugPrintf("PPB_PDF::HistogramPDFPageCount: %s\n", | 192 DebugPrintf("PPB_PDF::HistogramPDFPageCount: %s\n", |
| 193 NaClSrpcErrorString(srpc_result)); | 193 NaClSrpcErrorString(srpc_result)); |
| 194 } | 194 } |
| 195 | 195 |
| 196 void UserMetricsRecordAction(struct PP_Var action) { | 196 void UserMetricsRecordAction(struct PP_Var action) { |
| 197 DebugPrintf("PPB_PDF::UserMetricsRecordAction\n"); | 197 DebugPrintf("PPB_PDF::UserMetricsRecordAction\n"); |
| 198 | 198 |
| 199 nacl_abi_size_t action_size = kMaxVarSize; | 199 nacl_abi_size_t action_size = 0; |
| 200 nacl::scoped_array<char> action_bytes( | 200 nacl::scoped_array<char> action_bytes( |
| 201 Serialize(&action, 1, &action_size)); | 201 Serialize(&action, 1, &action_size)); |
| 202 NaClSrpcError srpc_result = | 202 NaClSrpcError srpc_result = |
| 203 PpbPdfRpcClient::PPB_PDF_UserMetricsRecordAction(GetMainSrpcChannel(), | 203 PpbPdfRpcClient::PPB_PDF_UserMetricsRecordAction(GetMainSrpcChannel(), |
| 204 action_size, | 204 action_size, |
| 205 action_bytes.get()); | 205 action_bytes.get()); |
| 206 | 206 |
| 207 DebugPrintf("PPB_PDF::UserMetricsRecordAction: %s\n", | 207 DebugPrintf("PPB_PDF::UserMetricsRecordAction: %s\n", |
| 208 NaClSrpcErrorString(srpc_result)); | 208 NaClSrpcErrorString(srpc_result)); |
| 209 } | 209 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 SetContentRestriction, | 244 SetContentRestriction, |
| 245 HistogramPDFPageCount, | 245 HistogramPDFPageCount, |
| 246 UserMetricsRecordAction, | 246 UserMetricsRecordAction, |
| 247 HasUnsupportedFeature, | 247 HasUnsupportedFeature, |
| 248 SaveAs | 248 SaveAs |
| 249 }; | 249 }; |
| 250 return &pdf_interface; | 250 return &pdf_interface; |
| 251 } | 251 } |
| 252 | 252 |
| 253 } // namespace ppapi_proxy | 253 } // namespace ppapi_proxy |
| 254 | |
| OLD | NEW |