| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 ui::TextInputType* type); | 42 ui::TextInputType* type); |
| 43 | 43 |
| 44 // This method returns the number of RenderWidgetHostViews which are currently | 44 // This method returns the number of RenderWidgetHostViews which are currently |
| 45 // registered with the TextInputManager that is owned by |web_contents|. | 45 // registered with the TextInputManager that is owned by |web_contents|. |
| 46 size_t GetRegisteredViewsCountFromTextInputManager(WebContents* web_contents); | 46 size_t GetRegisteredViewsCountFromTextInputManager(WebContents* web_contents); |
| 47 | 47 |
| 48 // Returns the RWHV corresponding to the frame with a focused <input> within the | 48 // Returns the RWHV corresponding to the frame with a focused <input> within the |
| 49 // given WebContents. | 49 // given WebContents. |
| 50 RenderWidgetHostView* GetActiveViewFromWebContents(WebContents* web_contents); | 50 RenderWidgetHostView* GetActiveViewFromWebContents(WebContents* web_contents); |
| 51 | 51 |
| 52 // This method will send an InputMsg_ImeSetComposition IPC with the provided | 52 // This method will send a request for an immediate update on composition range |
| 53 // parameters to the |render_widget_host|. | 53 // from TextInputManager's active widget corresponding to the |web_contents|. |
| 54 void SetCompositionForRenderWidgetHost( | 54 // This function will return false if the request is not successfully sent; |
| 55 RenderWidgetHost* render_widget_host, | 55 // either due to missing TextInputManager or lack of an active widget. |
| 56 const base::string16& text, | 56 bool RequestCompositionInfoFromActiveWidget(WebContents* web_contents); |
| 57 const std::vector<ui::CompositionUnderline>& underlines, | |
| 58 const gfx::Range& replacement_range, | |
| 59 int selection_start, | |
| 60 int selection_end); | |
| 61 | 57 |
| 62 // This class provides the necessary API for accessing the state of and also | 58 // This class provides the necessary API for accessing the state of and also |
| 63 // observing the TextInputManager for WebContents. | 59 // observing the TextInputManager for WebContents. |
| 64 class TextInputManagerTester { | 60 class TextInputManagerTester { |
| 65 public: | 61 public: |
| 66 TextInputManagerTester(WebContents* web_contents); | 62 TextInputManagerTester(WebContents* web_contents); |
| 67 virtual ~TextInputManagerTester(); | 63 virtual ~TextInputManagerTester(); |
| 68 | 64 |
| 69 // Sets a callback which is invoked when a RWHV calls UpdateTextInputState | 65 // Sets a callback which is invoked when a RWHV calls UpdateTextInputState |
| 70 // on the TextInputManager which is being observed. | 66 // on the TextInputManager which is being observed. |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 const base::Closure& callback) = 0; | 176 const base::Closure& callback) = 0; |
| 181 virtual void SetOnShowImeIfNeededCallback(const base::Closure& callback) = 0; | 177 virtual void SetOnShowImeIfNeededCallback(const base::Closure& callback) = 0; |
| 182 | 178 |
| 183 protected: | 179 protected: |
| 184 TestInputMethodObserver(); | 180 TestInputMethodObserver(); |
| 185 }; | 181 }; |
| 186 | 182 |
| 187 } // namespace content | 183 } // namespace content |
| 188 | 184 |
| 189 #endif // CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ | 185 #endif // CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ |
| OLD | NEW |