Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Unified Diff: content/browser/renderer_host/text_input_manager.h

Issue 2057803002: Tracking SelectionBounds for all RenderWidgets on the Browser Side (Aura Only) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 7dcbdfc2e82fcfc0078e75b3a8f52228d2193411..4801eec295b89a0f20c8a45083e546fd04277a3f 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 {
@@ -35,6 +39,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();
@@ -50,10 +58,16 @@ 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();
+
// Updates the TextInputState for |view|.
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
@@ -82,14 +96,19 @@ 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);
// The view with active text input state.
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_;
base::ObserverList<Observer> observer_list_;

Powered by Google App Engine
This is Rietveld 408576698