Chromium Code Reviews| 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 #ifndef CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ |
| 6 #define CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ | 6 #define CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 void SetUpdateTextInputStateCalledCallback(const base::Closure& callback); | 71 void SetUpdateTextInputStateCalledCallback(const base::Closure& callback); |
| 72 | 72 |
| 73 // Sets a callback which is invoked when a RWHV calls SelectionBoundsChanged | 73 // Sets a callback which is invoked when a RWHV calls SelectionBoundsChanged |
| 74 // on the TextInputManager which is being observed. | 74 // on the TextInputManager which is being observed. |
| 75 void SetOnSelectionBoundsChangedCallback(const base::Closure& callback); | 75 void SetOnSelectionBoundsChangedCallback(const base::Closure& callback); |
| 76 | 76 |
| 77 // Sets a callback which is invoked when a RWHV calls | 77 // Sets a callback which is invoked when a RWHV calls |
| 78 // ImeCompositionRangeChanged on the TextInputManager that is being observed. | 78 // ImeCompositionRangeChanged on the TextInputManager that is being observed. |
| 79 void SetOnImeCompositionRangeChangedCallback(const base::Closure& callback); | 79 void SetOnImeCompositionRangeChangedCallback(const base::Closure& callback); |
| 80 | 80 |
| 81 // Sets a callback which is invoked when a RWHV calls SelectionChanged on the | |
| 82 // TextInputManager which is being observed. | |
| 83 void SetOnTextSelectionChangedCallback(const base::Closure& callback); | |
| 84 | |
| 81 // Returns true if there is a focused <input> and populates |type| with | 85 // Returns true if there is a focused <input> and populates |type| with |
| 82 // |TextInputState.type| of the TextInputManager. | 86 // |TextInputState.type| of the TextInputManager. |
| 83 bool GetTextInputType(ui::TextInputType* type); | 87 bool GetTextInputType(ui::TextInputType* type); |
| 84 | 88 |
| 85 // Returns true if there is a focused <input> and populates |value| with | 89 // Returns true if there is a focused <input> and populates |value| with |
| 86 // |TextInputState.value| of the TextInputManager. | 90 // |TextInputState.value| of the TextInputManager. |
| 87 bool GetTextInputValue(std::string* value); | 91 bool GetTextInputValue(std::string* value); |
| 88 | 92 |
| 93 // Returns true if there is a focused <input> and populates |length| with the | |
| 94 // length of the selected text range in the focused view. | |
| 95 bool GetCurrentTextSelectionLength(size_t* length); | |
| 96 | |
|
EhsanK
2016/07/18 15:21:29
TextSelection could be for non-<input> but as far
| |
| 89 // Returns the RenderWidgetHostView with a focused <input> element or nullptr | 97 // Returns the RenderWidgetHostView with a focused <input> element or nullptr |
| 90 // if none exists. | 98 // if none exists. |
| 91 const RenderWidgetHostView* GetActiveView(); | 99 const RenderWidgetHostView* GetActiveView(); |
| 92 | 100 |
| 93 // Returns the RenderWidgetHostView which has most recently updated any of its | 101 // Returns the RenderWidgetHostView which has most recently updated any of its |
| 94 // state (e.g., TextInputState or otherwise). | 102 // state (e.g., TextInputState or otherwise). |
| 95 const RenderWidgetHostView* GetUpdatedView(); | 103 const RenderWidgetHostView* GetUpdatedView(); |
| 96 | 104 |
| 97 // Returns true if a call to TextInputManager::UpdateTextInputState has led | 105 // Returns true if a call to TextInputManager::UpdateTextInputState has led |
| 98 // to a change in TextInputState (since the time the observer has been | 106 // to a change in TextInputState (since the time the observer has been |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 const base::Closure& callback) = 0; | 180 const base::Closure& callback) = 0; |
| 173 virtual void SetOnShowImeIfNeededCallback(const base::Closure& callback) = 0; | 181 virtual void SetOnShowImeIfNeededCallback(const base::Closure& callback) = 0; |
| 174 | 182 |
| 175 protected: | 183 protected: |
| 176 TestInputMethodObserver(); | 184 TestInputMethodObserver(); |
| 177 }; | 185 }; |
| 178 | 186 |
| 179 } // namespace content | 187 } // namespace content |
| 180 | 188 |
| 181 #endif // CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ | 189 #endif // CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ |
| OLD | NEW |