Roll leveldb from r73 to r75.
[chromium-blink-merge.git] / ppapi / cpp / dev / find_dev.h
blob89c2d5a0cf57ef8186ae1e6c83277665b2cef29c
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.
5 #ifndef PPAPI_CPP_DEV_FIND_DEV_H_
6 #define PPAPI_CPP_DEV_FIND_DEV_H_
8 #include <string>
10 #include "ppapi/c/dev/ppp_find_dev.h"
11 #include "ppapi/cpp/instance_handle.h"
13 namespace pp {
15 class Instance;
17 // This class allows you to associate the PPP_Find and PPB_Find C-based
18 // interfaces with an object. It associates itself with the given instance, and
19 // registers as the global handler for handling the PPP_Find interface that the
20 // browser calls.
22 // You would typically use this either via inheritance on your instance:
23 // class MyInstance : public pp::Instance, public pp::Find_Dev {
24 // class MyInstance() : pp::Find_Dev(this) {
25 // }
26 // ...
27 // };
29 // or by composition:
30 // class MyFinder : public pp::Find {
31 // ...
32 // };
34 // class MyInstance : public pp::Instance {
35 // MyInstance() : finder_(this) {
36 // }
38 // MyFinder finder_;
39 // };
40 class Find_Dev {
41 public:
42 // The instance parameter must outlive this class.
43 Find_Dev(Instance* instance);
44 virtual ~Find_Dev();
46 // PPP_Find_Dev functions exposed as virtual functions for you to
47 // override.
48 virtual bool StartFind(const std::string& text, bool case_sensitive) = 0;
49 virtual void SelectFindResult(bool forward) = 0;
50 virtual void StopFind() = 0;
52 // PPB_Find_Def functions for you to call to report find results.
53 void NumberOfFindResultsChanged(int32_t total, bool final_result);
54 void SelectedFindResultChanged(int32_t index);
56 private:
57 InstanceHandle associated_instance_;
60 } // namespace pp
62 #endif // PPAPI_CPP_DEV_FIND_DEV_H_