| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/test_runner/text_input_controller.h" | 5 #include "components/test_runner/text_input_controller.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "components/test_runner/web_view_test_proxy.h" | 8 #include "components/test_runner/web_view_test_proxy.h" |
| 9 #include "gin/arguments.h" | 9 #include "gin/arguments.h" |
| 10 #include "gin/handle.h" | 10 #include "gin/handle.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 : web_view_test_proxy_base_(web_view_test_proxy_base), | 153 : web_view_test_proxy_base_(web_view_test_proxy_base), |
| 154 weak_factory_(this) {} | 154 weak_factory_(this) {} |
| 155 | 155 |
| 156 TextInputController::~TextInputController() {} | 156 TextInputController::~TextInputController() {} |
| 157 | 157 |
| 158 void TextInputController::Install(blink::WebLocalFrame* frame) { | 158 void TextInputController::Install(blink::WebLocalFrame* frame) { |
| 159 TextInputControllerBindings::Install(weak_factory_.GetWeakPtr(), frame); | 159 TextInputControllerBindings::Install(weak_factory_.GetWeakPtr(), frame); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void TextInputController::InsertText(const std::string& text) { | 162 void TextInputController::InsertText(const std::string& text) { |
| 163 view()->confirmComposition(blink::WebString::fromUTF8(text)); | 163 view()->commitText(blink::WebString::fromUTF8(text), 0); |
| 164 } | 164 } |
| 165 | 165 |
| 166 void TextInputController::UnmarkText() { | 166 void TextInputController::UnmarkText() { |
| 167 view()->confirmComposition(); | 167 view()->finishComposingText(blink::WebWidget::KeepSelection); |
| 168 } | 168 } |
| 169 | 169 |
| 170 void TextInputController::DoCommand(const std::string& text) { | 170 void TextInputController::DoCommand(const std::string& text) { |
| 171 if (view()->mainFrame()) { | 171 if (view()->mainFrame()) { |
| 172 if (!view()->mainFrame()->toWebLocalFrame()) { | 172 if (!view()->mainFrame()->toWebLocalFrame()) { |
| 173 CHECK(false) << "This function cannot be called if the main frame is not" | 173 CHECK(false) << "This function cannot be called if the main frame is not" |
| 174 "a local frame."; | 174 "a local frame."; |
| 175 } | 175 } |
| 176 view()->mainFrame()->toWebLocalFrame()->executeCommand( | 176 view()->mainFrame()->toWebLocalFrame()->executeCommand( |
| 177 blink::WebString::fromUTF8(text)); | 177 blink::WebString::fromUTF8(text)); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 view()->setComposition( | 295 view()->setComposition( |
| 296 newText, blink::WebVector<blink::WebCompositionUnderline>(underlines), | 296 newText, blink::WebVector<blink::WebCompositionUnderline>(underlines), |
| 297 textLength, textLength); | 297 textLength, textLength); |
| 298 } | 298 } |
| 299 | 299 |
| 300 blink::WebView* TextInputController::view() { | 300 blink::WebView* TextInputController::view() { |
| 301 return web_view_test_proxy_base_->web_view(); | 301 return web_view_test_proxy_base_->web_view(); |
| 302 } | 302 } |
| 303 | 303 |
| 304 } // namespace test_runner | 304 } // namespace test_runner |
| OLD | NEW |