Delete unused downloads page asset.
[chromium-blink-merge.git] / ppapi / cpp / private / find_private.h
blob268033b6218f4772da2ab9191ed5719da888b697
1 // Copyright 2014 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_PRIVATE_FIND_PRIVATE_H_
6 #define PPAPI_CPP_PRIVATE_FIND_PRIVATE_H_
8 #include <string>
9 #include <vector>
11 #include "ppapi/c/private/ppp_find_private.h"
12 #include "ppapi/cpp/instance_handle.h"
14 namespace pp {
16 class Instance;
17 class Rect;
19 // This class allows you to associate the PPP_Find and PPB_Find C-based
20 // interfaces with an object. It associates itself with the given instance, and
21 // registers as the global handler for handling the PPP_Find interface that the
22 // browser calls.
24 // You would typically use this either via inheritance on your instance:
25 // class MyInstance : public pp::Instance, public pp::Find_Private {
26 // class MyInstance() : pp::Find_Private(this) {
27 // }
28 // ...
29 // };
31 // or by composition:
32 // class MyFinder : public pp::Find {
33 // ...
34 // };
36 // class MyInstance : public pp::Instance {
37 // MyInstance() : finder_(this) {
38 // }
40 // MyFinder finder_;
41 // };
42 class Find_Private {
43 public:
44 // The instance parameter must outlive this class.
45 Find_Private(Instance* instance);
46 virtual ~Find_Private();
48 // PPP_Find_Private functions exposed as virtual functions for you to
49 // override.
50 virtual bool StartFind(const std::string& text, bool case_sensitive) = 0;
51 virtual void SelectFindResult(bool forward) = 0;
52 virtual void StopFind() = 0;
54 // PPB_Find_Private functions for you to call to report find results.
55 void SetPluginToHandleFindRequests();
56 void NumberOfFindResultsChanged(int32_t total, bool final_result);
57 void SelectedFindResultChanged(int32_t index);
58 void SetTickmarks(const std::vector<pp::Rect>& tickmarks);
60 private:
61 InstanceHandle associated_instance_;
64 } // namespace pp
66 #endif // PPAPI_CPP_PRIVATE_FIND_PRIVATE_H_