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 "ppapi/cpp/dev/text_input_dev.h" | 5 #include "ppapi/cpp/dev/text_input_dev.h" |
6 | 6 |
7 #include "ppapi/c/dev/ppp_text_input_dev.h" | 7 #include "ppapi/c/dev/ppp_text_input_dev.h" |
8 #include "ppapi/cpp/instance.h" | 8 #include "ppapi/cpp/instance.h" |
9 #include "ppapi/cpp/instance_handle.h" | 9 #include "ppapi/cpp/instance_handle.h" |
10 #include "ppapi/cpp/module_impl.h" | 10 #include "ppapi/cpp/module_impl.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 &ppp_text_input); | 47 &ppp_text_input); |
48 instance->AddPerInstanceObject(kPPPTextInputInterface, this); | 48 instance->AddPerInstanceObject(kPPPTextInputInterface, this); |
49 } | 49 } |
50 | 50 |
51 TextInput_Dev::~TextInput_Dev() { | 51 TextInput_Dev::~TextInput_Dev() { |
52 Instance::RemovePerInstanceObject(instance_, kPPPTextInputInterface, this); | 52 Instance::RemovePerInstanceObject(instance_, kPPPTextInputInterface, this); |
53 } | 53 } |
54 | 54 |
55 void TextInput_Dev::RequestSurroundingText(uint32_t) { | 55 void TextInput_Dev::RequestSurroundingText(uint32_t) { |
56 // Default implementation. Send a null range. | 56 // Default implementation. Send a null range. |
57 UpdateSurroundingText("", 0, 0); | 57 UpdateSurroundingText(std::string(), 0, 0); |
58 } | 58 } |
59 | 59 |
60 void TextInput_Dev::SetTextInputType(PP_TextInput_Type type) { | 60 void TextInput_Dev::SetTextInputType(PP_TextInput_Type type) { |
61 if (has_interface<PPB_TextInput_Dev_0_2>()) { | 61 if (has_interface<PPB_TextInput_Dev_0_2>()) { |
62 get_interface<PPB_TextInput_Dev_0_2>()->SetTextInputType( | 62 get_interface<PPB_TextInput_Dev_0_2>()->SetTextInputType( |
63 instance_.pp_instance(), type); | 63 instance_.pp_instance(), type); |
64 } else if (has_interface<PPB_TextInput_Dev_0_1>()) { | 64 } else if (has_interface<PPB_TextInput_Dev_0_1>()) { |
65 get_interface<PPB_TextInput_Dev_0_1>()->SetTextInputType( | 65 get_interface<PPB_TextInput_Dev_0_1>()->SetTextInputType( |
66 instance_.pp_instance(), type); | 66 instance_.pp_instance(), type); |
67 } | 67 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 uint32_t caret, | 99 uint32_t caret, |
100 uint32_t anchor) { | 100 uint32_t anchor) { |
101 if (has_interface<PPB_TextInput_Dev_0_2>()) { | 101 if (has_interface<PPB_TextInput_Dev_0_2>()) { |
102 get_interface<PPB_TextInput_Dev_0_2>()->UpdateSurroundingText( | 102 get_interface<PPB_TextInput_Dev_0_2>()->UpdateSurroundingText( |
103 instance_.pp_instance(), text.c_str(), caret, anchor); | 103 instance_.pp_instance(), text.c_str(), caret, anchor); |
104 } | 104 } |
105 } | 105 } |
106 | 106 |
107 | 107 |
108 } // namespace pp | 108 } // namespace pp |
OLD | NEW |