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 "native_client/src/shared/ppapi_proxy/browser_ppp_selection.h" | 5 #include "native_client/src/shared/ppapi_proxy/browser_ppp_selection.h" |
6 | 6 |
7 // Include file order cannot be observed because ppp_instance declares a | 7 // Include file order cannot be observed because ppp_instance declares a |
8 // structure return type that causes an error on Windows. | 8 // structure return type that causes an error on Windows. |
9 // TODO(sehr, brettw): fix the return types and include order in PPAPI. | 9 // TODO(sehr, brettw): fix the return types and include order in PPAPI. |
10 #include "ppapi/c/pp_instance.h" | 10 #include "ppapi/c/pp_instance.h" |
11 #include "ppapi/c/pp_rect.h" | 11 #include "ppapi/c/pp_rect.h" |
12 #include "ppapi/c/pp_resource.h" | 12 #include "ppapi/c/pp_resource.h" |
13 #include "srpcgen/ppp_rpc.h" | 13 #include "srpcgen/ppp_rpc.h" |
14 #include "native_client/src/include/nacl_scoped_ptr.h" | 14 #include "native_client/src/include/nacl_scoped_ptr.h" |
15 #include "native_client/src/include/portability.h" | 15 #include "native_client/src/include/portability.h" |
16 #include "native_client/src/shared/ppapi_proxy/browser_globals.h" | 16 #include "native_client/src/shared/ppapi_proxy/browser_globals.h" |
17 #include "native_client/src/shared/ppapi_proxy/browser_ppp.h" | 17 #include "native_client/src/shared/ppapi_proxy/browser_ppp.h" |
18 #include "native_client/src/shared/ppapi_proxy/object_serialize.h" | 18 #include "native_client/src/shared/ppapi_proxy/object_serialize.h" |
19 #include "native_client/src/shared/ppapi_proxy/utility.h" | 19 #include "native_client/src/shared/ppapi_proxy/utility.h" |
20 | 20 |
21 namespace ppapi_proxy { | 21 namespace ppapi_proxy { |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 struct PP_Var GetSelectedText(PP_Instance instance, PP_Bool html) { | 25 struct PP_Var GetSelectedText(PP_Instance instance, PP_Bool html) { |
26 DebugPrintf("PPP_Selection_Dev::GetSelectedText: " | 26 DebugPrintf("PPP_Selection_Dev::GetSelectedText: " |
27 "instance=%"NACL_PRIu32"\n", instance); | 27 "instance=%"NACL_PRId32"\n", instance); |
28 NaClSrpcChannel* channel = GetMainSrpcChannel(instance); | 28 NaClSrpcChannel* channel = GetMainSrpcChannel(instance); |
29 nacl_abi_size_t text_size = kMaxReturnVarSize; | 29 nacl_abi_size_t text_size = kMaxReturnVarSize; |
30 nacl::scoped_array<char> text_bytes(new char[text_size]); | 30 nacl::scoped_array<char> text_bytes(new char[text_size]); |
31 NaClSrpcError srpc_result = | 31 NaClSrpcError srpc_result = |
32 PppSelectionRpcClient::PPP_Selection_GetSelectedText( | 32 PppSelectionRpcClient::PPP_Selection_GetSelectedText( |
33 channel, | 33 channel, |
34 instance, | 34 instance, |
35 static_cast<int32_t>(html), | 35 static_cast<int32_t>(html), |
36 &text_size, | 36 &text_size, |
37 text_bytes.get()); | 37 text_bytes.get()); |
(...skipping 11 matching lines...) Expand all Loading... |
49 } // namespace | 49 } // namespace |
50 | 50 |
51 const PPP_Selection_Dev* BrowserSelection::GetInterface() { | 51 const PPP_Selection_Dev* BrowserSelection::GetInterface() { |
52 static const PPP_Selection_Dev selection_interface = { | 52 static const PPP_Selection_Dev selection_interface = { |
53 GetSelectedText | 53 GetSelectedText |
54 }; | 54 }; |
55 return &selection_interface; | 55 return &selection_interface; |
56 } | 56 } |
57 | 57 |
58 } // namespace ppapi_proxy | 58 } // namespace ppapi_proxy |
OLD | NEW |