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

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: Addressing one comment Created 7 years, 4 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
« no previous file with comments | « ppapi/cpp/text_input_controller.h ('k') | ppapi/examples/ime/ime.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 #include "ppapi/cpp/var.h"
10
11 namespace pp {
12
13 namespace {
14
15 template <> const char* interface_name<PPB_TextInputController_1_0>() {
16 return PPB_TEXTINPUTCONTROLLER_INTERFACE_1_0;
17 }
18
19 } // namespace
20
21
22 TextInputController::TextInputController(const InstanceHandle& instance)
23 : instance_(instance) {
24 }
25
26 TextInputController::~TextInputController() {
27 }
28
29 void TextInputController::SetTextInputType(PP_TextInput_Type type) {
30 if (has_interface<PPB_TextInputController_1_0>()) {
31 get_interface<PPB_TextInputController_1_0>()->SetTextInputType(
32 instance_.pp_instance(), type);
33 }
34 }
35
36 void TextInputController::UpdateCaretPosition(const Rect& caret) {
37 if (has_interface<PPB_TextInputController_1_0>()) {
38 get_interface<PPB_TextInputController_1_0>()->UpdateCaretPosition(
39 instance_.pp_instance(), &caret.pp_rect());
40 }
41 }
42
43 void TextInputController::CancelCompositionText() {
44 if (has_interface<PPB_TextInputController_1_0>()) {
45 get_interface<PPB_TextInputController_1_0>()->CancelCompositionText(
46 instance_.pp_instance());
47 }
48 }
49
50 void TextInputController::UpdateSurroundingText(const Var& text,
51 uint32_t caret,
52 uint32_t anchor) {
53 if (has_interface<PPB_TextInputController_1_0>()) {
54 get_interface<PPB_TextInputController_1_0>()->UpdateSurroundingText(
55 instance_.pp_instance(),
56 text.pp_var(),
57 caret,
58 anchor);
59 }
60 }
61
62
63 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/text_input_controller.h ('k') | ppapi/examples/ime/ime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698