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

Side by Side Diff: ppapi/cpp/dev/find_dev.cc

Issue 197623005: Rename PPB_Find_Dev to PPB_Find_Private (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « ppapi/cpp/dev/find_dev.h ('k') | ppapi/cpp/dev/printing_dev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium 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 "ppapi/cpp/dev/find_dev.h"
6
7 #include "ppapi/c/dev/ppb_find_dev.h"
8 #include "ppapi/cpp/instance.h"
9 #include "ppapi/cpp/module.h"
10 #include "ppapi/cpp/module_impl.h"
11
12 namespace pp {
13
14 namespace {
15
16 template <> const char* interface_name<PPB_Find_Dev>() {
17 return PPB_FIND_DEV_INTERFACE;
18 }
19
20 static const char kPPPFindInterface[] = PPP_FIND_DEV_INTERFACE;
21
22 PP_Bool StartFind(PP_Instance instance,
23 const char* text,
24 PP_Bool case_sensitive) {
25 void* object = Instance::GetPerInstanceObject(instance, kPPPFindInterface);
26 if (!object)
27 return PP_FALSE;
28 bool return_value = static_cast<Find_Dev*>(object)->StartFind(
29 text, PP_ToBool(case_sensitive));
30 return PP_FromBool(return_value);
31 }
32
33 void SelectFindResult(PP_Instance instance, PP_Bool forward) {
34 void* object = Instance::GetPerInstanceObject(instance, kPPPFindInterface);
35 if (object)
36 static_cast<Find_Dev*>(object)->SelectFindResult(PP_ToBool(forward));
37 }
38
39 void StopFind(PP_Instance instance) {
40 void* object = Instance::GetPerInstanceObject(instance, kPPPFindInterface);
41 if (object)
42 static_cast<Find_Dev*>(object)->StopFind();
43 }
44
45 const PPP_Find_Dev ppp_find = {
46 &StartFind,
47 &SelectFindResult,
48 &StopFind
49 };
50
51 } // namespace
52
53 Find_Dev::Find_Dev(Instance* instance) : associated_instance_(instance) {
54 Module::Get()->AddPluginInterface(kPPPFindInterface, &ppp_find);
55 instance->AddPerInstanceObject(kPPPFindInterface, this);
56 }
57
58 Find_Dev::~Find_Dev() {
59 Instance::RemovePerInstanceObject(associated_instance_,
60 kPPPFindInterface, this);
61 }
62
63 void Find_Dev::SetPluginToHandleFindRequests() {
64 if (has_interface<PPB_Find_Dev>()) {
65 get_interface<PPB_Find_Dev>()->SetPluginToHandleFindRequests(
66 associated_instance_.pp_instance());
67 }
68 }
69
70 void Find_Dev::NumberOfFindResultsChanged(int32_t total, bool final_result) {
71 if (has_interface<PPB_Find_Dev>()) {
72 get_interface<PPB_Find_Dev>()->NumberOfFindResultsChanged(
73 associated_instance_.pp_instance(), total, PP_FromBool(final_result));
74 }
75 }
76
77 void Find_Dev::SelectedFindResultChanged(int32_t index) {
78 if (has_interface<PPB_Find_Dev>()) {
79 get_interface<PPB_Find_Dev>()->SelectedFindResultChanged(
80 associated_instance_.pp_instance(), index);
81 }
82 }
83
84 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/find_dev.h ('k') | ppapi/cpp/dev/printing_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698