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

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

Issue 9381010: Convert resources to take an instance key instead of an Instance*. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: USELESS PATCH TITLE Created 8 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/file_chooser_dev.cc ('k') | ppapi/cpp/dev/find_dev.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 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 #ifndef PPAPI_CPP_DEV_FIND_DEV_H_ 5 #ifndef PPAPI_CPP_DEV_FIND_DEV_H_
6 #define PPAPI_CPP_DEV_FIND_DEV_H_ 6 #define PPAPI_CPP_DEV_FIND_DEV_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "ppapi/c/dev/ppp_find_dev.h" 10 #include "ppapi/c/dev/ppp_find_dev.h"
11 #include "ppapi/cpp/instance_handle.h"
11 12
12 namespace pp { 13 namespace pp {
13 14
14 class Instance;
15
16 // This class allows you to associate the PPP_Find and PPB_Find C-based 15 // This class allows you to associate the PPP_Find and PPB_Find C-based
17 // interfaces with an object. It associates itself with the given instance, and 16 // interfaces with an object. It associates itself with the given instance, and
18 // registers as the global handler for handling the PPP_Find interface that the 17 // registers as the global handler for handling the PPP_Find interface that the
19 // browser calls. 18 // browser calls.
20 // 19 //
21 // You would typically use this either via inheritance on your instance: 20 // You would typically use this either via inheritance on your instance:
22 // class MyInstance : public pp::Instance, public pp::Find_Dev { 21 // class MyInstance : public pp::Instance, public pp::Find_Dev {
23 // class MyInstance() : pp::Find_Dev(this) { 22 // class MyInstance() : pp::Find_Dev(this) {
24 // } 23 // }
25 // ... 24 // ...
26 // }; 25 // };
27 // 26 //
28 // or by composition: 27 // or by composition:
29 // class MyFinder : public pp::Find { 28 // class MyFinder : public pp::Find {
30 // ... 29 // ...
31 // }; 30 // };
32 // 31 //
33 // class MyInstance : public pp::Instance { 32 // class MyInstance : public pp::Instance {
34 // MyInstance() : finder_(this) { 33 // MyInstance() : finder_(this) {
35 // } 34 // }
36 // 35 //
37 // MyFinder finder_; 36 // MyFinder finder_;
38 // }; 37 // };
39 class Find_Dev { 38 class Find_Dev {
40 public: 39 public:
41 // The instance parameter must outlive this class. 40 // The instance parameter must outlive this class.
42 Find_Dev(Instance* instance); 41 Find_Dev(const InstanceHandle& instance);
43 virtual ~Find_Dev(); 42 virtual ~Find_Dev();
44 43
45 // PPP_Find_Dev functions exposed as virtual functions for you to 44 // PPP_Find_Dev functions exposed as virtual functions for you to
46 // override. 45 // override.
47 virtual bool StartFind(const std::string& text, bool case_sensitive) = 0; 46 virtual bool StartFind(const std::string& text, bool case_sensitive) = 0;
48 virtual void SelectFindResult(bool forward) = 0; 47 virtual void SelectFindResult(bool forward) = 0;
49 virtual void StopFind() = 0; 48 virtual void StopFind() = 0;
50 49
51 // PPB_Find_Def functions for you to call to report find results. 50 // PPB_Find_Def functions for you to call to report find results.
52 void NumberOfFindResultsChanged(int32_t total, bool final_result); 51 void NumberOfFindResultsChanged(int32_t total, bool final_result);
53 void SelectedFindResultChanged(int32_t index); 52 void SelectedFindResultChanged(int32_t index);
54 53
55 private: 54 private:
56 Instance* associated_instance_; 55 InstanceHandle associated_instance_;
57 }; 56 };
58 57
59 } // namespace pp 58 } // namespace pp
60 59
61 #endif // PPAPI_CPP_DEV_FIND_DEV_H_ 60 #endif // PPAPI_CPP_DEV_FIND_DEV_H_
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/file_chooser_dev.cc ('k') | ppapi/cpp/dev/find_dev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698