OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/cpp/instance.h" | 7 #include "ppapi/cpp/instance_handle.h" |
8 #include "ppapi/cpp/module_impl.h" | 8 #include "ppapi/cpp/module_impl.h" |
9 #include "ppapi/cpp/rect.h" | 9 #include "ppapi/cpp/rect.h" |
10 | 10 |
11 namespace pp { | 11 namespace pp { |
12 | 12 |
13 namespace { | 13 namespace { |
14 | 14 |
15 template <> const char* interface_name<PPB_TextInput_Dev>() { | 15 template <> const char* interface_name<PPB_TextInput_Dev>() { |
16 return PPB_TEXTINPUT_DEV_INTERFACE; | 16 return PPB_TEXTINPUT_DEV_INTERFACE; |
17 } | 17 } |
18 | 18 |
19 } // namespace | 19 } // namespace |
20 | 20 |
21 | 21 |
22 TextInput_Dev::TextInput_Dev(Instance* instance) : instance_(instance) { | 22 TextInput_Dev::TextInput_Dev(const InstanceHandle& instance) |
| 23 : instance_(instance) { |
23 } | 24 } |
24 | 25 |
25 TextInput_Dev::~TextInput_Dev() { | 26 TextInput_Dev::~TextInput_Dev() { |
26 } | 27 } |
27 | 28 |
28 void TextInput_Dev::SetTextInputType(PP_TextInput_Type type) { | 29 void TextInput_Dev::SetTextInputType(PP_TextInput_Type type) { |
29 if (!has_interface<PPB_TextInput_Dev>()) | 30 if (!has_interface<PPB_TextInput_Dev>()) |
30 return; | 31 return; |
31 get_interface<PPB_TextInput_Dev>()->SetTextInputType( | 32 get_interface<PPB_TextInput_Dev>()->SetTextInputType( |
32 instance_->pp_instance(), type); | 33 instance_.pp_instance(), type); |
33 } | 34 } |
34 | 35 |
35 void TextInput_Dev::UpdateCaretPosition(const Rect& caret, | 36 void TextInput_Dev::UpdateCaretPosition(const Rect& caret, |
36 const Rect& bounding_box) { | 37 const Rect& bounding_box) { |
37 if (!has_interface<PPB_TextInput_Dev>()) | 38 if (!has_interface<PPB_TextInput_Dev>()) |
38 return; | 39 return; |
39 get_interface<PPB_TextInput_Dev>()->UpdateCaretPosition( | 40 get_interface<PPB_TextInput_Dev>()->UpdateCaretPosition( |
40 instance_->pp_instance(), &caret.pp_rect(), &bounding_box.pp_rect()); | 41 instance_.pp_instance(), &caret.pp_rect(), &bounding_box.pp_rect()); |
41 } | 42 } |
42 | 43 |
43 void TextInput_Dev::CancelCompositionText() { | 44 void TextInput_Dev::CancelCompositionText() { |
44 if (!has_interface<PPB_TextInput_Dev>()) | 45 if (!has_interface<PPB_TextInput_Dev>()) |
45 return; | 46 return; |
46 get_interface<PPB_TextInput_Dev>()->CancelCompositionText( | 47 get_interface<PPB_TextInput_Dev>()->CancelCompositionText( |
47 instance_->pp_instance()); | 48 instance_.pp_instance()); |
48 } | 49 } |
49 | 50 |
50 } // namespace pp | 51 } // namespace pp |
OLD | NEW |