OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 #ifndef COMPONENTS_TEST_RUNNER_TEXT_INPUT_CONTROLLER_H_ | |
6 #define COMPONENTS_TEST_RUNNER_TEXT_INPUT_CONTROLLER_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/macros.h" | |
12 #include "base/memory/weak_ptr.h" | |
13 | |
14 namespace blink { | |
15 class WebInputMethodController; | |
16 class WebLocalFrame; | |
17 class WebView; | |
18 } | |
19 | |
20 namespace test_runner { | |
21 | |
22 class WebViewTestProxyBase; | |
23 | |
24 // TextInputController is bound to window.textInputController in Javascript | |
25 // when content_shell is running. Layout tests use it to exercise various | |
26 // corners of text input. | |
27 class TextInputController { | |
28 public: | |
29 explicit TextInputController(WebViewTestProxyBase* web_view_test_proxy_base); | |
30 ~TextInputController(); | |
31 | |
32 void Install(blink::WebLocalFrame* frame); | |
33 | |
34 private: | |
35 friend class TextInputControllerBindings; | |
36 | |
37 void InsertText(const std::string& text); | |
38 void UnmarkText(); | |
39 void DoCommand(const std::string& text); | |
40 void SetMarkedText(const std::string& text, int start, int length); | |
41 bool HasMarkedText(); | |
42 std::vector<int> MarkedRange(); | |
43 std::vector<int> SelectedRange(); | |
44 std::vector<int> FirstRectForCharacterRange(unsigned location, | |
45 unsigned length); | |
46 void SetComposition(const std::string& text); | |
47 void ForceTextInputStateUpdate(); | |
48 | |
49 blink::WebView* view(); | |
50 // Returns the WebInputMethodController corresponding to the focused frame | |
51 // accepting IME. Could return nullptr if no such frame exists. | |
52 blink::WebInputMethodController* GetInputMethodController(); | |
53 | |
54 WebViewTestProxyBase* web_view_test_proxy_base_; | |
55 | |
56 base::WeakPtrFactory<TextInputController> weak_factory_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(TextInputController); | |
59 }; | |
60 | |
61 } // namespace test_runner | |
62 | |
63 #endif // COMPONENTS_TEST_RUNNER_TEXT_INPUT_CONTROLLER_H_ | |
OLD | NEW |