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> | |
|
Charlie Reis
2016/06/28 21:39:34
Is this stale? (Maybe it belongs in the .cc file?
EhsanK
2016/06/28 22:47:10
Thanks for pointing this out. This goes to cc and
| |
| 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 number of RenderWidgetHostViews which are currently | |
| 37 // registered with the TextInputManager that is owned by |web_contents|. | |
| 38 size_t GetRegisteredViewsCountFromTextInputManager(WebContents* web_contents); | |
| 39 | |
| 35 // Returns the RWHV corresponding to the frame with a focused <input> within the | 40 // Returns the RWHV corresponding to the frame with a focused <input> within the |
| 36 // given WebContents. | 41 // given WebContents. |
| 37 RenderWidgetHostView* GetActiveViewFromWebContents(WebContents* web_contents); | 42 RenderWidgetHostView* GetActiveViewFromWebContents(WebContents* web_contents); |
| 38 | 43 |
| 39 // This class provides the necessary API for accessing the state of and also | 44 // This class provides the necessary API for accessing the state of and also |
| 40 // observing the TextInputManager for WebContents. | 45 // observing the TextInputManager for WebContents. |
| 41 class TextInputManagerTester { | 46 class TextInputManagerTester { |
| 42 public: | 47 public: |
| 43 using Callback = base::Callback<void(TextInputManagerTester*)>; | 48 using Callback = base::Callback<void(TextInputManagerTester*)>; |
| 44 | 49 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 const base::Closure& callback) = 0; | 149 const base::Closure& callback) = 0; |
| 145 virtual void SetOnShowImeIfNeededCallback(const base::Closure& callback) = 0; | 150 virtual void SetOnShowImeIfNeededCallback(const base::Closure& callback) = 0; |
| 146 | 151 |
| 147 protected: | 152 protected: |
| 148 TestInputMethodObserver(); | 153 TestInputMethodObserver(); |
| 149 }; | 154 }; |
| 150 | 155 |
| 151 } // namespace content | 156 } // namespace content |
| 152 | 157 |
| 153 #endif // CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ | 158 #endif // CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ |
| OLD | NEW |