Chromium Code Reviews| Index: content/browser/renderer_host/text_input_manager.h |
| diff --git a/content/browser/renderer_host/text_input_manager.h b/content/browser/renderer_host/text_input_manager.h |
| index 39309a58342d79e126b7b0ad9d279d5f2ec8cbad..68e7a0623e9a01b6b710b4c105cea5d61929897b 100644 |
| --- a/content/browser/renderer_host/text_input_manager.h |
| +++ b/content/browser/renderer_host/text_input_manager.h |
| @@ -10,6 +10,10 @@ |
| #include "base/observer_list.h" |
| #include "content/common/content_export.h" |
| #include "content/common/text_input_state.h" |
| +#include "ui/gfx/geometry/rect.h" |
| +#include "ui/gfx/selection_bound.h" |
| + |
| +struct ViewHostMsg_SelectionBounds_Params; |
| namespace content { |
| @@ -36,6 +40,10 @@ class CONTENT_EXPORT TextInputManager { |
| TextInputManager* text_input_manager, |
| RenderWidgetHostViewBase* updated_view, |
| bool did_update_state) {} |
| + // Called when the selection bounds for the |updated_view| has changed. |
| + virtual void OnSelectionBoundsChanged( |
| + TextInputManager* text_input_manager, |
| + RenderWidgetHostViewBase* updated_view) {} |
| }; |
| TextInputManager(); |
| @@ -54,6 +62,9 @@ class CONTENT_EXPORT TextInputManager { |
| // dangling if the TextInputManager or |active_view_| might go away. |
| const TextInputState* GetTextInputState(); |
| + // Returns the rect between selection bounds for the |active_view_|. |
| + gfx::Rect GetSelectionBoundsRect(); |
| + |
| // --------------------------------------------------------------------------- |
| // The following methods are called by RWHVs on the tab to update their IME- |
| // related state. |
| @@ -62,6 +73,9 @@ class CONTENT_EXPORT TextInputManager { |
| void UpdateTextInputState(RenderWidgetHostViewBase* view, |
| const TextInputState& state); |
| + void SelectionBoundsChanged(RenderWidgetHostViewBase* view, |
| + const ViewHostMsg_SelectionBounds_Params& params); |
| + |
| // Registers the given |view| for tracking its TextInputState. This is called |
| // by any view which has updates in its TextInputState (whether tab's RWHV or |
| // that of a child frame). The |view| must unregister itself before being |
| @@ -92,6 +106,10 @@ class CONTENT_EXPORT TextInputManager { |
| RenderWidgetHostView* view, |
| ui::TextInputType* type); |
| + template <class Value> |
| + class ViewMap : public std::unordered_map<RenderWidgetHostViewBase*, Value> { |
| + }; |
| + |
| void NotifyObserversAboutInputStateUpdate(RenderWidgetHostViewBase* view, |
| bool did_update_state); |
| @@ -100,8 +118,9 @@ class CONTENT_EXPORT TextInputManager { |
| // cannot have a |TextInputState.type| of ui::TEXT_INPUT_TYPE_NONE. |
| RenderWidgetHostViewBase* active_view_; |
| - std::unordered_map<RenderWidgetHostViewBase*, TextInputState> |
| - text_input_state_map_; |
| + ViewMap<TextInputState> text_input_state_map_; |
| + ViewMap<gfx::SelectionBound> selection_anchor_map_; |
| + ViewMap<gfx::SelectionBound> selection_focus_map_; |
|
kenrb
2016/06/28 19:15:23
I'm not sure about this, but is it better to do it
EhsanK
2016/06/29 17:09:58
I made the two selection related one a map into a
|
| base::ObserverList<Observer> observer_list_; |