| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 void SetOnTextSelectionChangedCallback(const base::Closure& callback); | 116 void SetOnTextSelectionChangedCallback(const base::Closure& callback); |
| 117 | 117 |
| 118 // Returns true if there is a focused <input> and populates |type| with | 118 // Returns true if there is a focused <input> and populates |type| with |
| 119 // |TextInputState.type| of the TextInputManager. | 119 // |TextInputState.type| of the TextInputManager. |
| 120 bool GetTextInputType(ui::TextInputType* type); | 120 bool GetTextInputType(ui::TextInputType* type); |
| 121 | 121 |
| 122 // Returns true if there is a focused <input> and populates |value| with | 122 // Returns true if there is a focused <input> and populates |value| with |
| 123 // |TextInputState.value| of the TextInputManager. | 123 // |TextInputState.value| of the TextInputManager. |
| 124 bool GetTextInputValue(std::string* value); | 124 bool GetTextInputValue(std::string* value); |
| 125 | 125 |
| 126 // Returns true if there is a focused <input> and populates |position| with |
| 127 // |TextInputState.selection_start| of the TextInputManager. |
| 128 bool GetTextInputCursorPosition(int* position); |
| 129 |
| 126 // Returns true if there is a focused <input> and populates |length| with the | 130 // Returns true if there is a focused <input> and populates |length| with the |
| 127 // length of the selected text range in the focused view. | 131 // length of the selected text range in the focused view. |
| 128 bool GetCurrentTextSelectionLength(size_t* length); | 132 bool GetCurrentTextSelectionLength(size_t* length); |
| 129 | 133 |
| 130 // This method sets |output| to the last value of composition range length | 134 // This method sets |output| to the last value of composition range length |
| 131 // reported by a renderer corresponding to WebContents. If no such update have | 135 // reported by a renderer corresponding to WebContents. If no such update have |
| 132 // been received, the method will leave |output| untouched and returns false. | 136 // been received, the method will leave |output| untouched and returns false. |
| 133 // Returning true means an update has been received and the value of |output| | 137 // Returning true means an update has been received and the value of |output| |
| 134 // has been updated accordingly. | 138 // has been updated accordingly. |
| 135 bool GetLastCompositionRangeLength(uint32_t* output); | 139 bool GetLastCompositionRangeLength(uint32_t* output); |
| 136 | 140 |
| 137 // Returns the RenderWidgetHostView with a focused <input> element or nullptr | 141 // Returns the RenderWidgetHostView with a focused <input> element or nullptr |
| 138 // if none exists. | 142 // if none exists. |
| 139 const RenderWidgetHostView* GetActiveView(); | 143 const RenderWidgetHostView* GetActiveView(); |
| 140 | 144 |
| 141 // Returns the RenderWidgetHostView which has most recently updated any of its | 145 // Returns the RenderWidgetHostView which has most recently updated any of its |
| 142 // state (e.g., TextInputState or otherwise). | 146 // state (e.g., TextInputState or otherwise). |
| 143 RenderWidgetHostView* GetUpdatedView(); | 147 RenderWidgetHostView* GetUpdatedView(); |
| 144 | 148 |
| 145 // Returns true if a call to TextInputManager::UpdateTextInputState has led | 149 // Returns true if a call to TextInputManager::UpdateTextInputState has led |
| 146 // to a change in TextInputState (since the time the observer has been | 150 // to a change in TextInputState (since the time the observer has been |
| 147 // created). | 151 // created). |
| 148 bool IsTextInputStateChanged(); | 152 bool IsTextInputStateChanged(); |
| 149 | 153 |
| 154 // Returns true if there is a focused <input> and populates |user_initiated| |
| 155 // with the information whether it was triggered by user interaction in the |
| 156 // given view. |
| 157 bool GetTextSelectionUserInitiatedForView(RenderWidgetHostView* view, |
| 158 bool* user_initiated); |
| 159 |
| 150 private: | 160 private: |
| 151 // The actual internal observer of the TextInputManager. | 161 // The actual internal observer of the TextInputManager. |
| 152 class InternalObserver; | 162 class InternalObserver; |
| 153 | 163 |
| 154 std::unique_ptr<InternalObserver> observer_; | 164 std::unique_ptr<InternalObserver> observer_; |
| 155 | 165 |
| 156 DISALLOW_COPY_AND_ASSIGN(TextInputManagerTester); | 166 DISALLOW_COPY_AND_ASSIGN(TextInputManagerTester); |
| 157 }; | 167 }; |
| 158 | 168 |
| 159 // This class observes the lifetime of a RenderWidgetHostView. | 169 // This class observes the lifetime of a RenderWidgetHostView. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 const gfx::Range& range); | 275 const gfx::Range& range); |
| 266 | 276 |
| 267 // Returns the total count of NSWindows instances which belong to the currently | 277 // Returns the total count of NSWindows instances which belong to the currently |
| 268 // running NSApplication. | 278 // running NSApplication. |
| 269 size_t GetOpenNSWindowsCount(); | 279 size_t GetOpenNSWindowsCount(); |
| 270 #endif | 280 #endif |
| 271 | 281 |
| 272 } // namespace content | 282 } // namespace content |
| 273 | 283 |
| 274 #endif // CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ | 284 #endif // CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ |
| OLD | NEW |