| 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_BROWSER_RENDERER_HOST_TEXT_INPUT_MANAGER_H__ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_MANAGER_H__ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_MANAGER_H__ | 6 #define CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_MANAGER_H__ |
| 7 | 7 |
| 8 #include <unordered_map> | 8 #include <unordered_map> |
| 9 | 9 |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // Add and remove observers for notifications regarding updates in the | 79 // Add and remove observers for notifications regarding updates in the |
| 80 // TextInputState. Clients must be sure to remove themselves before they go | 80 // TextInputState. Clients must be sure to remove themselves before they go |
| 81 // away. | 81 // away. |
| 82 // Only the tab's RWHV should observer TextInputManager. In tests, however, | 82 // Only the tab's RWHV should observer TextInputManager. In tests, however, |
| 83 // in addition to the tab's RWHV, one or more test observers might observe | 83 // in addition to the tab's RWHV, one or more test observers might observe |
| 84 // TextInputManager. | 84 // TextInputManager. |
| 85 void AddObserver(Observer* observer); | 85 void AddObserver(Observer* observer); |
| 86 void RemoveObserver(Observer* observer); | 86 void RemoveObserver(Observer* observer); |
| 87 | 87 |
| 88 RenderWidgetHostViewBase* active_view_for_testing() { return active_view_; } | 88 RenderWidgetHostViewBase* active_view_for_testing() { return active_view_; } |
| 89 size_t GetRegisteredViewsCountForTesting(); |
| 90 ui::TextInputType GetTextInputTypeForViewForTesting( |
| 91 RenderWidgetHostViewBase* view); |
| 89 | 92 |
| 90 private: | 93 private: |
| 91 friend bool GetTextInputTypeForView(WebContents* web_contents, | |
| 92 RenderWidgetHostView* view, | |
| 93 ui::TextInputType* type); | |
| 94 | |
| 95 void NotifyObserversAboutInputStateUpdate(RenderWidgetHostViewBase* view, | 94 void NotifyObserversAboutInputStateUpdate(RenderWidgetHostViewBase* view, |
| 96 bool did_update_state); | 95 bool did_update_state); |
| 97 | 96 |
| 98 // The view with active text input state, i.e., a focused <input> element. | 97 // The view with active text input state, i.e., a focused <input> element. |
| 99 // It will be nullptr if no such view exists. Note that the active view | 98 // It will be nullptr if no such view exists. Note that the active view |
| 100 // cannot have a |TextInputState.type| of ui::TEXT_INPUT_TYPE_NONE. | 99 // cannot have a |TextInputState.type| of ui::TEXT_INPUT_TYPE_NONE. |
| 101 RenderWidgetHostViewBase* active_view_; | 100 RenderWidgetHostViewBase* active_view_; |
| 102 | 101 |
| 103 std::unordered_map<RenderWidgetHostViewBase*, TextInputState> | 102 std::unordered_map<RenderWidgetHostViewBase*, TextInputState> |
| 104 text_input_state_map_; | 103 text_input_state_map_; |
| 105 | 104 |
| 106 base::ObserverList<Observer> observer_list_; | 105 base::ObserverList<Observer> observer_list_; |
| 107 | 106 |
| 108 DISALLOW_COPY_AND_ASSIGN(TextInputManager); | 107 DISALLOW_COPY_AND_ASSIGN(TextInputManager); |
| 109 }; | 108 }; |
| 110 } | 109 } |
| 111 | 110 |
| 112 #endif // CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_MANAGER_H__ | 111 #endif // CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_MANAGER_H__ |
| OLD | NEW |