Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_find.cc

Issue 7740013: Cloning a bunch of stuff from the native_client repository at r6528 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Native Client 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.
4
5 #include "native_client/src/shared/ppapi_proxy/browser_ppp_find.h"
6
7 #include <string.h>
8
9 // Include file order cannot be observed because ppp_instance declares a
10 // structure return type that causes an error on Windows.
11 // TODO(sehr, brettw): fix the return types and include order in PPAPI.
12 #include "ppapi/c/pp_instance.h"
13 #include "ppapi/c/pp_resource.h"
14 #include "srpcgen/ppp_rpc.h"
15 #include "native_client/src/include/portability.h"
16 #include "native_client/src/shared/ppapi_proxy/browser_globals.h"
17 #include "native_client/src/shared/ppapi_proxy/browser_ppp.h"
18 #include "native_client/src/shared/ppapi_proxy/utility.h"
19
20 namespace ppapi_proxy {
21
22 namespace {
23
24 PP_Bool StartFind(PP_Instance instance,
25 const char* text,
26 PP_Bool case_sensitive) {
27 DebugPrintf("PPP_Find::StartFind: instance=%"NACL_PRIu32"\n", instance);
28
29 int32_t supports_find = 0;
30 nacl_abi_size_t text_bytes = static_cast<nacl_abi_size_t>(strlen(text));
31 NaClSrpcError srpc_result = PppFindRpcClient::PPP_Find_StartFind(
32 GetMainSrpcChannel(instance),
33 instance,
34 text_bytes, const_cast<char*>(text),
35 static_cast<int32_t>(case_sensitive),
36 &supports_find);
37
38 DebugPrintf("PPP_Find::StartFind: %s\n", NaClSrpcErrorString(srpc_result));
39 return supports_find ? PP_TRUE : PP_FALSE;
40 }
41
42 void SelectFindResult(PP_Instance instance,
43 PP_Bool forward) {
44 DebugPrintf("PPP_Find::SelectFindResult: "
45 "instance=%"NACL_PRIu32"\n", instance);
46
47 NaClSrpcError srpc_result = PppFindRpcClient::PPP_Find_SelectFindResult(
48 GetMainSrpcChannel(instance),
49 instance,
50 static_cast<int32_t>(forward));
51
52 DebugPrintf("PPP_Find::SelectFindResult: %s\n",
53 NaClSrpcErrorString(srpc_result));
54 }
55
56 void StopFind(PP_Instance instance) {
57 DebugPrintf("PPP_Find::StopFind: instance=%"NACL_PRIu32"\n", instance);
58
59 NaClSrpcError srpc_result = PppFindRpcClient::PPP_Find_StopFind(
60 GetMainSrpcChannel(instance),
61 instance);
62
63 DebugPrintf("PPP_Find::StopFind: %s\n", NaClSrpcErrorString(srpc_result));
64 }
65
66 } // namespace
67
68 const PPP_Find_Dev* BrowserFind::GetInterface() {
69 static const PPP_Find_Dev find_interface = {
70 StartFind,
71 SelectFindResult,
72 StopFind
73 };
74 return &find_interface;
75 }
76
77 } // namespace ppapi_proxy
78
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698