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 #include <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ppapi/c/dev/ppb_cursor_control_dev.h" | 10 #include "ppapi/c/dev/ppb_cursor_control_dev.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // Implement TextFieldStatusHandler. | 105 // Implement TextFieldStatusHandler. |
106 virtual void FocusIn(const pp::Rect& caret) { | 106 virtual void FocusIn(const pp::Rect& caret) { |
107 textinput_control_.SetTextInputType(PP_TEXTINPUT_TYPE_TEXT); | 107 textinput_control_.SetTextInputType(PP_TEXTINPUT_TYPE_TEXT); |
108 textinput_control_.UpdateCaretPosition(caret); | 108 textinput_control_.UpdateCaretPosition(caret); |
109 } | 109 } |
110 virtual void FocusOut() { | 110 virtual void FocusOut() { |
111 textinput_control_.CancelCompositionText(); | 111 textinput_control_.CancelCompositionText(); |
112 textinput_control_.SetTextInputType(PP_TEXTINPUT_TYPE_NONE); | 112 textinput_control_.SetTextInputType(PP_TEXTINPUT_TYPE_NONE); |
113 } | 113 } |
114 virtual void UpdateSelection(const std::string& text) { | 114 virtual void UpdateSelection(const std::string& text) { |
115 textinput_control_.UpdateSurroundingText(text, 0, text.size()); | 115 textinput_control_.UpdateSurroundingText( |
| 116 text, 0, static_cast<uint32_t>(text.size())); |
116 } | 117 } |
117 | 118 |
118 private: | 119 private: |
119 pp::TextInputController textinput_control_; | 120 pp::TextInputController textinput_control_; |
120 }; | 121 }; |
121 | 122 |
122 // Hand-made text field for demonstrating text input API. | 123 // Hand-made text field for demonstrating text input API. |
123 class MyTextField { | 124 class MyTextField { |
124 public: | 125 public: |
125 MyTextField(pp::Instance* instance, TextFieldStatusHandler* handler, | 126 MyTextField(pp::Instance* instance, TextFieldStatusHandler* handler, |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 } | 725 } |
725 }; | 726 }; |
726 | 727 |
727 namespace pp { | 728 namespace pp { |
728 | 729 |
729 Module* CreateModule() { | 730 Module* CreateModule() { |
730 return new MyModule(); | 731 return new MyModule(); |
731 } | 732 } |
732 | 733 |
733 } // namespace pp | 734 } // namespace pp |
OLD | NEW |