| 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 2bb4c16d9e5f27f2f7b754f4f3676a54daa74c2e..9f7233343501ffd0fdc4da8242ab5d1548d201aa 100644
|
| --- a/content/browser/renderer_host/text_input_manager.h
|
| +++ b/content/browser/renderer_host/text_input_manager.h
|
| @@ -6,10 +6,15 @@
|
| #define CONTENT_BROWSER_RENDERER_HOST_TEXT_INPUT_MANAGER_H__
|
|
|
| #include <unordered_map>
|
| +#include <utility>
|
|
|
| #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 {
|
|
|
| @@ -41,6 +46,10 @@ class CONTENT_EXPORT TextInputManager {
|
| virtual void OnImeCancelComposition(
|
| TextInputManager* text_input_manager,
|
| RenderWidgetHostViewBase* updated_view) {}
|
| + // Called when the selection bounds for the |updated_view| has changed.
|
| + virtual void OnSelectionBoundsChanged(
|
| + TextInputManager* text_input_manager,
|
| + RenderWidgetHostViewBase* updated_view) {}
|
| };
|
|
|
| TextInputManager();
|
| @@ -59,6 +68,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.
|
| @@ -71,6 +83,9 @@ class CONTENT_EXPORT TextInputManager {
|
| // the widget corresponding to |view|.
|
| void ImeCancelComposition(RenderWidgetHostViewBase* view);
|
|
|
| + 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
|
| @@ -100,6 +115,10 @@ class CONTENT_EXPORT TextInputManager {
|
| RenderWidgetHostViewBase* view);
|
|
|
| private:
|
| + template <class Value>
|
| + class ViewMap : public std::unordered_map<RenderWidgetHostViewBase*, Value> {
|
| + };
|
| +
|
| void NotifyObserversAboutInputStateUpdate(RenderWidgetHostViewBase* view,
|
| bool did_update_state);
|
|
|
| @@ -108,8 +127,14 @@ 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_;
|
| +
|
| +#if defined(USE_AURA)
|
| + // Maps a registered view to a pair of selection bounds where the first bound
|
| + // is selection anchor and the second is selection focus.
|
| + ViewMap<std::pair<gfx::SelectionBound, gfx::SelectionBound>>
|
| + selection_bound_map_;
|
| +#endif
|
|
|
| base::ObserverList<Observer> observer_list_;
|
|
|
|
|