OLD | NEW |
---|---|
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_SELECTION_DEV_H_ | 5 #ifndef PPAPI_CPP_DEV_SELECTION_DEV_H_ |
6 #define PPAPI_CPP_DEV_SELECTION_DEV_H_ | 6 #define PPAPI_CPP_DEV_SELECTION_DEV_H_ |
7 | 7 |
8 #include "ppapi/c/dev/ppp_selection_dev.h" | 8 #include "ppapi/c/dev/ppp_selection_dev.h" |
9 #include "ppapi/cpp/instance_handle.h" | |
9 | 10 |
10 namespace pp { | 11 namespace pp { |
11 | 12 |
12 class Instance; | |
13 class Var; | 13 class Var; |
14 | 14 |
15 // This class allows you to associate the PPP_Selection_Dev C-based interface | 15 // This class allows you to associate the PPP_Selection_Dev C-based interface |
16 // with an object. It registers as the global handler for handling the | 16 // with an object. It registers as the global handler for handling the |
17 // PPP_Selection_Dev interface that the browser calls. | 17 // PPP_Selection_Dev interface that the browser calls. |
18 // | 18 // |
19 // You would typically use this either via inheritance on your instance: | 19 // You would typically use this either via inheritance on your instance: |
20 // class MyInstance : public pp::Instance, public pp::Selection_Dev { | 20 // class MyInstance : public pp::Instance, public pp::Selection_Dev { |
21 // class MyInstance() : pp::Selection_Dev(this) { | 21 // class MyInstance() : pp::Selection_Dev(this) { |
22 // } | 22 // } |
23 // ... | 23 // ... |
24 // }; | 24 // }; |
25 // | 25 // |
26 // or by composition: | 26 // or by composition: |
27 // class MySelection : public pp::Selection_Dev { | 27 // class MySelection : public pp::Selection_Dev { |
28 // ... | 28 // ... |
29 // }; | 29 // }; |
30 // | 30 // |
31 // class MyInstance : public pp::Instance { | 31 // class MyInstance : public pp::Instance { |
32 // MyInstance() : selection_(this) { | 32 // MyInstance() : selection_(this) { |
33 // } | 33 // } |
34 // | 34 // |
35 // MySelection selection_; | 35 // MySelection selection_; |
36 // }; | 36 // }; |
37 class Selection_Dev { | 37 class Selection_Dev { |
38 public: | 38 public: |
39 Selection_Dev(Instance* instance); | 39 Selection_Dev(const InstanceHandle& instance); |
dmichael (off chromium)
2012/02/22 21:38:44
explicit
| |
40 virtual ~Selection_Dev(); | 40 virtual ~Selection_Dev(); |
41 | 41 |
42 // PPP_Selection_Dev functions exposed as virtual functions for you to | 42 // PPP_Selection_Dev functions exposed as virtual functions for you to |
43 // override. | 43 // override. |
44 virtual Var GetSelectedText(bool html) = 0; | 44 virtual Var GetSelectedText(bool html) = 0; |
45 | 45 |
46 private: | 46 private: |
47 Instance* associated_instance_; | 47 InstanceHandle associated_instance_; |
48 }; | 48 }; |
49 | 49 |
50 } // namespace pp | 50 } // namespace pp |
51 | 51 |
52 #endif // PPAPI_CPP_DEV_SELECTION_DEV_H_ | 52 #endif // PPAPI_CPP_DEV_SELECTION_DEV_H_ |
OLD | NEW |