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.
5 #ifndef COMPONENTS_TEST_RUNNER_TEXT_INPUT_CONTROLLER_H_
6 #define COMPONENTS_TEST_RUNNER_TEXT_INPUT_CONTROLLER_H_
11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
19 namespace test_runner
{
21 // TextInputController is bound to window.textInputController in Javascript
22 // when content_shell is running. Layout tests use it to exercise various
23 // corners of text input.
24 class TextInputController
: public base::SupportsWeakPtr
<TextInputController
> {
26 TextInputController();
27 ~TextInputController();
29 void Install(blink::WebFrame
* frame
);
31 void SetWebView(blink::WebView
* view
);
34 friend class TextInputControllerBindings
;
36 void InsertText(const std::string
& text
);
38 void DoCommand(const std::string
& text
);
39 void SetMarkedText(const std::string
& text
, int start
, int length
);
41 std::vector
<int> MarkedRange();
42 std::vector
<int> SelectedRange();
43 std::vector
<int> FirstRectForCharacterRange(unsigned location
,
45 void SetComposition(const std::string
& text
);
47 blink::WebView
* view_
;
49 base::WeakPtrFactory
<TextInputController
> weak_factory_
;
51 DISALLOW_COPY_AND_ASSIGN(TextInputController
);
54 } // namespace test_runner
56 #endif // COMPONENTS_TEST_RUNNER_TEXT_INPUT_CONTROLLER_H_