| 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_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" |
| 11 #include "gin/object_template_builder.h" | 11 #include "gin/object_template_builder.h" |
| 12 #include "gin/wrappable.h" | 12 #include "gin/wrappable.h" |
| 13 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 13 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
| 14 #include "third_party/WebKit/public/web/WebInputEvent.h" | 14 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 15 #include "third_party/WebKit/public/web/WebKit.h" | 15 #include "third_party/WebKit/public/web/WebKit.h" |
| 16 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 16 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 17 #include "third_party/WebKit/public/web/WebRange.h" | 17 #include "third_party/WebKit/public/web/WebRange.h" |
| 18 #include "third_party/WebKit/public/web/WebView.h" | 18 #include "third_party/WebKit/public/web/WebView.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 : std::vector<int>(); | 141 : std::vector<int>(); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void TextInputControllerBindings::SetComposition(const std::string& text) { | 144 void TextInputControllerBindings::SetComposition(const std::string& text) { |
| 145 if (controller_) | 145 if (controller_) |
| 146 controller_->SetComposition(text); | 146 controller_->SetComposition(text); |
| 147 } | 147 } |
| 148 | 148 |
| 149 // TextInputController --------------------------------------------------------- | 149 // TextInputController --------------------------------------------------------- |
| 150 | 150 |
| 151 TextInputController::TextInputController(WebTestProxyBase* web_test_proxy_base) | 151 TextInputController::TextInputController( |
| 152 : web_test_proxy_base_(web_test_proxy_base), weak_factory_(this) {} | 152 WebViewTestProxyBase* web_view_test_proxy_base) |
| 153 : web_view_test_proxy_base_(web_view_test_proxy_base), |
| 154 weak_factory_(this) {} |
| 153 | 155 |
| 154 TextInputController::~TextInputController() {} | 156 TextInputController::~TextInputController() {} |
| 155 | 157 |
| 156 void TextInputController::Install(blink::WebLocalFrame* frame) { | 158 void TextInputController::Install(blink::WebLocalFrame* frame) { |
| 157 TextInputControllerBindings::Install(weak_factory_.GetWeakPtr(), frame); | 159 TextInputControllerBindings::Install(weak_factory_.GetWeakPtr(), frame); |
| 158 } | 160 } |
| 159 | 161 |
| 160 void TextInputController::InsertText(const std::string& text) { | 162 void TextInputController::InsertText(const std::string& text) { |
| 161 view()->confirmComposition(blink::WebString::fromUTF8(text)); | 163 view()->confirmComposition(blink::WebString::fromUTF8(text)); |
| 162 } | 164 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 underlines.push_back(blink::WebCompositionUnderline(0, text.length(), | 287 underlines.push_back(blink::WebCompositionUnderline(0, text.length(), |
| 286 SK_ColorBLACK, false, | 288 SK_ColorBLACK, false, |
| 287 SK_ColorTRANSPARENT)); | 289 SK_ColorTRANSPARENT)); |
| 288 view()->setComposition( | 290 view()->setComposition( |
| 289 blink::WebString::fromUTF8(text), | 291 blink::WebString::fromUTF8(text), |
| 290 blink::WebVector<blink::WebCompositionUnderline>(underlines), | 292 blink::WebVector<blink::WebCompositionUnderline>(underlines), |
| 291 text.length(), text.length()); | 293 text.length(), text.length()); |
| 292 } | 294 } |
| 293 | 295 |
| 294 blink::WebView* TextInputController::view() { | 296 blink::WebView* TextInputController::view() { |
| 295 return web_test_proxy_base_->web_view(); | 297 return web_view_test_proxy_base_->web_view(); |
| 296 } | 298 } |
| 297 | 299 |
| 298 } // namespace test_runner | 300 } // namespace test_runner |
| OLD | NEW |