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 <unordered_map> | 9 #include <unordered_map> |
| 10 #include <unordered_set> | |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "ui/base/ime/text_input_mode.h" | 14 #include "ui/base/ime/text_input_mode.h" |
| 14 #include "ui/base/ime/text_input_type.h" | 15 #include "ui/base/ime/text_input_type.h" |
| 15 | 16 |
| 16 namespace content { | 17 namespace content { |
| 17 | 18 |
| 18 class RenderWidgetHostView; | 19 class RenderWidgetHostView; |
| 19 class RenderWidgetHostViewBase; | 20 class RenderWidgetHostViewBase; |
| 20 class WebContents; | 21 class WebContents; |
| 21 struct TextInputState; | 22 struct TextInputState; |
| 22 | 23 |
| 23 // Returns the |TextInputState.type| from the TextInputManager owned by | 24 // Returns the |TextInputState.type| from the TextInputManager owned by |
| 24 // |web_contents|. | 25 // |web_contents|. |
| 25 ui::TextInputType GetTextInputTypeFromWebContents(WebContents* web_contents); | 26 ui::TextInputType GetTextInputTypeFromWebContents(WebContents* web_contents); |
| 26 | 27 |
| 27 // This method returns true if |view| is registered in the TextInputManager that | 28 // This method returns true if |view| is registered in the TextInputManager that |
| 28 // is owned by |web_contents|. If that is the case, the value of |type| will be | 29 // is owned by |web_contents|. If that is the case, the value of |type| will be |
| 29 // the |TextInputState.type| corresponding to the |view|. Returns false if | 30 // the |TextInputState.type| corresponding to the |view|. Returns false if |
| 30 // |view| is not registered. | 31 // |view| is not registered. |
| 31 bool GetTextInputTypeForView(WebContents* web_contents, | 32 bool GetTextInputTypeForView(WebContents* web_contents, |
| 32 RenderWidgetHostView* view, | 33 RenderWidgetHostView* view, |
| 33 ui::TextInputType* type); | 34 ui::TextInputType* type); |
| 34 | 35 |
| 36 // This method returns the set of all the views which are currently being | |
|
Charlie Reis
2016/06/13 18:46:13
nit: all views
nit: currently registered
Also, le
EhsanK
2016/06/25 00:10:35
This method is changed to return the count only no
| |
| 37 // registered with the TextInputManager, as in, their TextInputState is being | |
| 38 // tracked by it. | |
| 39 std::unordered_set<RenderWidgetHostView*> | |
| 40 GetAllViewsRegisteredWithTextInputManager(WebContents* web_contents); | |
| 41 | |
| 35 // Returns the RWHV corresponding to the frame with a focused <input> within the | 42 // Returns the RWHV corresponding to the frame with a focused <input> within the |
| 36 // given WebContents. | 43 // given WebContents. |
| 37 RenderWidgetHostView* GetActiveViewFromWebContents(WebContents* web_contents); | 44 RenderWidgetHostView* GetActiveViewFromWebContents(WebContents* web_contents); |
| 38 | 45 |
| 39 // This class provides the necessary API for accessing the state of and also | 46 // This class provides the necessary API for accessing the state of and also |
| 40 // observing the TextInputManager for WebContents. | 47 // observing the TextInputManager for WebContents. |
| 41 class TextInputManagerTester { | 48 class TextInputManagerTester { |
| 42 public: | 49 public: |
| 43 using Callback = base::Callback<void(TextInputManagerTester*)>; | 50 using Callback = base::Callback<void(TextInputManagerTester*)>; |
| 44 | 51 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 const base::Closure& callback) = 0; | 151 const base::Closure& callback) = 0; |
| 145 virtual void SetOnShowImeIfNeededCallback(const base::Closure& callback) = 0; | 152 virtual void SetOnShowImeIfNeededCallback(const base::Closure& callback) = 0; |
| 146 | 153 |
| 147 protected: | 154 protected: |
| 148 TestInputMethodObserver(); | 155 TestInputMethodObserver(); |
| 149 }; | 156 }; |
| 150 | 157 |
| 151 } // namespace content | 158 } // namespace content |
| 152 | 159 |
| 153 #endif // CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ | 160 #endif // CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ |
| OLD | NEW |