| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/public/test/text_input_test_utils.h" | 5 #include "content/public/test/text_input_test_utils.h" |
| 6 | 6 |
| 7 #include <unordered_set> | 7 #include <unordered_set> |
| 8 | 8 |
| 9 #include "content/browser/frame_host/render_frame_host_impl.h" | 9 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 10 #include "content/browser/renderer_host/render_widget_host_impl.h" | 10 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 return true; | 384 return true; |
| 385 } | 385 } |
| 386 | 386 |
| 387 bool TextInputManagerTester::GetLastCompositionRangeLength(uint32_t* length) { | 387 bool TextInputManagerTester::GetLastCompositionRangeLength(uint32_t* length) { |
| 388 if (!observer_->last_composition_range()) | 388 if (!observer_->last_composition_range()) |
| 389 return false; | 389 return false; |
| 390 *length = observer_->last_composition_range()->length(); | 390 *length = observer_->last_composition_range()->length(); |
| 391 return true; | 391 return true; |
| 392 } | 392 } |
| 393 | 393 |
| 394 bool TextInputManagerTester::GetTextSelectionUserInitiatedForView( |
| 395 RenderWidgetHostView* view, |
| 396 bool* user_initiated) { |
| 397 TextInputManager* manager = observer_->text_input_manager(); |
| 398 DCHECK(manager); |
| 399 |
| 400 RenderWidgetHostViewBase* view_base = |
| 401 static_cast<RenderWidgetHostViewBase*>(view); |
| 402 if (!manager->IsRegistered(view_base)) |
| 403 return false; |
| 404 |
| 405 *user_initiated = manager->GetTextSelection(view_base)->user_initiated(); |
| 406 return true; |
| 407 } |
| 408 |
| 394 bool TextInputManagerTester::IsTextInputStateChanged() { | 409 bool TextInputManagerTester::IsTextInputStateChanged() { |
| 395 return observer_->text_input_state_changed(); | 410 return observer_->text_input_state_changed(); |
| 396 } | 411 } |
| 397 | 412 |
| 398 TestRenderWidgetHostViewDestructionObserver:: | 413 TestRenderWidgetHostViewDestructionObserver:: |
| 399 TestRenderWidgetHostViewDestructionObserver(RenderWidgetHostView* view) | 414 TestRenderWidgetHostViewDestructionObserver(RenderWidgetHostView* view) |
| 400 : observer_( | 415 : observer_( |
| 401 new InternalObserver(static_cast<RenderWidgetHostViewBase*>(view))) {} | 416 new InternalObserver(static_cast<RenderWidgetHostViewBase*>(view))) {} |
| 402 | 417 |
| 403 TestRenderWidgetHostViewDestructionObserver:: | 418 TestRenderWidgetHostViewDestructionObserver:: |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 | 474 |
| 460 #ifdef USE_AURA | 475 #ifdef USE_AURA |
| 461 RenderWidgetHostViewAura* view = static_cast<RenderWidgetHostViewAura*>( | 476 RenderWidgetHostViewAura* view = static_cast<RenderWidgetHostViewAura*>( |
| 462 web_contents->GetRenderWidgetHostView()); | 477 web_contents->GetRenderWidgetHostView()); |
| 463 observer.reset(new InputMethodObserverAura(view->GetInputMethod())); | 478 observer.reset(new InputMethodObserverAura(view->GetInputMethod())); |
| 464 #endif | 479 #endif |
| 465 return observer; | 480 return observer; |
| 466 } | 481 } |
| 467 | 482 |
| 468 } // namespace content | 483 } // namespace content |
| OLD | NEW |