OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_TEXT_INPUT_DEV_H_ | 5 #ifndef PPAPI_CPP_TEXT_INPUT_CONTROLLER_H_ |
6 #define PPAPI_CPP_DEV_TEXT_INPUT_DEV_H_ | 6 #define PPAPI_CPP_TEXT_INPUT_CONTROLLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ppapi/c/dev/ppb_text_input_dev.h" | 10 #include "ppapi/c/ppb_text_input_controller.h" |
11 #include "ppapi/cpp/instance_handle.h" | 11 #include "ppapi/cpp/instance_handle.h" |
12 | 12 |
13 namespace pp { | 13 namespace pp { |
14 | 14 |
15 class Rect; | 15 class Rect; |
16 class Instance; | 16 class Instance; |
17 | 17 |
18 // This class allows you to associate the PPP_TextInput_Dev and | 18 // This class allows you to associate the PPP_TextInputController and |
yzshen1
2013/07/23 16:48:20
There isn't PPP_TextInputController, right?
I thin
Seigo Nonaka
2013/07/24 09:05:37
Yes! Thanks.
Removed.
| |
19 // PPB_TextInput_Dev C-based interfaces with an object. It associates itself | 19 // PPB_TextInputController C-based interfaces with an object. It associates |
20 // with the given instance, and registers as the global handler for handling the | 20 // itself with the given instance, and registers as the global handler for |
21 // PPP_TextInput_Dev interface that the browser calls. | 21 // handling the PPP_TextInputController interface that the browser calls. |
22 // | 22 // |
23 // You would typically use this either via inheritance on your instance: | 23 // You would typically use this either via inheritance on your instance: |
24 // class MyInstance : public pp::Instance, public pp::TextInput_Dev { | 24 // class MyInstance : public pp::Instance, public pp::TextInputController { |
25 // MyInstance() : pp::TextInput_Dev(this) { | 25 // MyInstance() : pp::TextInputController(this) { |
26 // } | 26 // } |
27 // ... | 27 // ... |
28 // }; | 28 // }; |
29 // | 29 // |
30 // or by composition: | 30 // or by composition: |
31 // class MyTextInput : public pp::TextInput_Dev { | 31 // class MyTextInput : public pp::TextInputController { |
32 // ... | 32 // ... |
33 // }; | 33 // }; |
34 // | 34 // |
35 // class MyInstance : public pp::Instance { | 35 // class MyInstance : public pp::Instance { |
36 // MyInstance() : text_input_(this) { | 36 // MyInstance() : text_input_(this) { |
37 // } | 37 // } |
38 // | 38 // |
39 // MyTextInput text_input_; | 39 // MyTextInput text_input_; |
40 // }; | 40 // }; |
41 class TextInput_Dev { | 41 class TextInputController { |
42 public: | 42 public: |
43 explicit TextInput_Dev(Instance* instance); | 43 explicit TextInputController(Instance* instance); |
yzshen1
2013/07/23 16:48:20
I think usually cpp class constructors take const
Seigo Nonaka
2013/07/24 09:05:37
Done.
| |
44 virtual ~TextInput_Dev(); | 44 virtual ~TextInputController(); |
yzshen1
2013/07/23 16:48:20
Please remove virtual.
Seigo Nonaka
2013/07/24 09:05:37
Done.
| |
45 | |
46 virtual void RequestSurroundingText(uint32_t desired_number_of_characters); | |
47 | 45 |
48 void SetTextInputType(PP_TextInput_Type type); | 46 void SetTextInputType(PP_TextInput_Type type); |
49 void UpdateCaretPosition(const Rect& caret, const Rect& bounding_box); | 47 void UpdateCaretPosition(const Rect& caret, const Rect& bounding_box); |
50 void CancelCompositionText(); | 48 void CancelCompositionText(); |
51 void SelectionChanged(); | |
52 void UpdateSurroundingText(const std::string& text, | 49 void UpdateSurroundingText(const std::string& text, |
53 uint32_t caret, uint32_t anchor); | 50 uint32_t caret, uint32_t anchor); |
54 | 51 |
55 private: | 52 private: |
56 InstanceHandle instance_; | 53 InstanceHandle instance_; |
57 }; | 54 }; |
58 | 55 |
59 } // namespace pp | 56 } // namespace pp |
60 | 57 |
61 #endif // PPAPI_CPP_DEV_TEXT_INPUT_DEV_H_ | 58 #endif // PPAPI_CPP_TEXT_INPUT_CONTROLLER_H_ |
OLD | NEW |