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

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: Address comments 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/c/ppb_text_input_controller.h"
yzshen1 2013/07/23 16:48:20 it is not needed because the .h file has included
Seigo Nonaka 2013/07/24 09:05:37 Done.
8 #include "ppapi/cpp/instance.h"
yzshen1 2013/07/23 16:48:20 It isn't needed once we change the constructor to
Seigo Nonaka 2013/07/24 09:05:37 Done.
9 #include "ppapi/cpp/instance_handle.h"
yzshen1 2013/07/23 16:48:20 ditto.
Seigo Nonaka 2013/07/24 09:05:37 Done.
10 #include "ppapi/cpp/module_impl.h"
11 #include "ppapi/cpp/rect.h"
12
13 namespace pp {
14
15 namespace {
16
17 template <> const char* interface_name<PPB_TextInputController_1_0>() {
18 return PPB_TEXTINPUTCONTROLLER_INTERFACE_1_0;
19 }
20
21 } // namespace
22
23
24 TextInputController::TextInputController(Instance* instance)
25 : instance_(instance) {
26 }
27
28 TextInputController::~TextInputController() {
29 }
30
31 void TextInputController::SetTextInputType(PP_TextInput_Type type) {
32 if (has_interface<PPB_TextInputController_1_0>()) {
33 get_interface<PPB_TextInputController_1_0>()->SetTextInputType(
34 instance_.pp_instance(), type);
35 }
36 }
37
38 void TextInputController::UpdateCaretPosition(const Rect& caret,
39 const Rect& bounding_box) {
yzshen1 2013/07/23 16:48:20 wrong indent.
Seigo Nonaka 2013/07/24 09:05:37 Done.
40 if (has_interface<PPB_TextInputController_1_0>()) {
41 get_interface<PPB_TextInputController_1_0>()->UpdateCaretPosition(
42 instance_.pp_instance(), &caret.pp_rect(), &bounding_box.pp_rect());
43 }
44 }
45
46 void TextInputController::CancelCompositionText() {
47 if (has_interface<PPB_TextInputController_1_0>()) {
48 get_interface<PPB_TextInputController_1_0>()->CancelCompositionText(
49 instance_.pp_instance());
50 }
51 }
52
53 void TextInputController::UpdateSurroundingText(const std::string& text,
54 uint32_t caret,
yzshen1 2013/07/23 16:48:20 wrong indent.
Seigo Nonaka 2013/07/24 09:05:37 Done.
55 uint32_t anchor) {
56 if (has_interface<PPB_TextInputController_1_0>()) {
57 get_interface<PPB_TextInputController_1_0>()->UpdateSurroundingText(
58 instance_.pp_instance(), text.c_str(), caret, anchor);
59 }
60 }
61
62
63 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698