Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: ppapi/cpp/text_input_controller.cc

Issue 18671004: PPAPI: Move IMEInputEvent and TextInput to stable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nitpick Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ppapi/cpp/text_input_controller.h"
6
7 #include "ppapi/cpp/module_impl.h"
8 #include "ppapi/cpp/rect.h"
9
10 namespace pp {
11
12 namespace {
13
14 template <> const char* interface_name<PPB_TextInputController_1_0>() {
15 return PPB_TEXTINPUTCONTROLLER_INTERFACE_1_0;
16 }
17
18 } // namespace
19
20
21 TextInputController::TextInputController(const InstanceHandle& instance)
22 : instance_(instance) {
23 }
24
25 TextInputController::~TextInputController() {
26 }
27
28 void TextInputController::SetTextInputType(PP_TextInput_Type type) {
29 if (has_interface<PPB_TextInputController_1_0>()) {
30 get_interface<PPB_TextInputController_1_0>()->SetTextInputType(
31 instance_.pp_instance(), type);
32 }
33 }
34
35 void TextInputController::UpdateCaretPosition(const Rect& caret) {
36 if (has_interface<PPB_TextInputController_1_0>()) {
37 get_interface<PPB_TextInputController_1_0>()->UpdateCaretPosition(
38 instance_.pp_instance(), &caret.pp_rect());
39 }
40 }
41
42 void TextInputController::CancelCompositionText() {
43 if (has_interface<PPB_TextInputController_1_0>()) {
44 get_interface<PPB_TextInputController_1_0>()->CancelCompositionText(
45 instance_.pp_instance());
46 }
47 }
48
49 void TextInputController::UpdateSurroundingText(const std::string& text,
50 uint32_t caret,
51 uint32_t anchor) {
52 if (has_interface<PPB_TextInputController_1_0>()) {
53 get_interface<PPB_TextInputController_1_0>()->UpdateSurroundingText(
54 instance_.pp_instance(), text.c_str(), caret, anchor);
55 }
56 }
57
58
59 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698