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

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

Issue 2694543002: [refactor] Cleanup IME State in RenderWidgetHostViewMac which is already tracked by TextInputManager (Closed)
Patch Set: Fixed another compile error for Android test Created 3 years, 10 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 40f404832368514a8d898e1814719bda1f90ea86..215b03d5e97f576a544cfd362ee6480a73c3bddf 100644
--- a/content/browser/renderer_host/text_input_manager.h
+++ b/content/browser/renderer_host/text_input_manager.h
@@ -92,25 +92,43 @@ class CONTENT_EXPORT TextInputManager {
gfx::Range range;
};
- // This struct is used to store text selection related information for views.
- struct TextSelection {
+ // This class is used to store text selection information for views. The text
+ // selection information includes a range around the selected (highlighted)
+ // text which is defined by an offset from the beginning of the page/frame,
+ // a range for the selection, and the text including the selection which
+ // might include several characters before and after it.
+ class TextSelection {
+ public:
TextSelection();
TextSelection(const TextSelection& other);
~TextSelection();
- // If text selection is valid, |text| will be populated with the selected
- // text and the method will return true. Otherwise, it will return false.
- bool GetSelectedText(base::string16* text) const;
+ void SetSelection(const base::string16& text,
+ size_t offset,
+ const gfx::Range& range);
+
+ const base::string16& selected_text() const { return selected_text_; }
+ size_t offset() const { return offset_; }
+ const gfx::Range& range() const { return range_; }
+ const base::string16& text() const { return text_; }
+ private:
// The offset of the text stored in |text| relative to the start of the web
// page.
- size_t offset;
+ size_t offset_;
- // The current selection range relative to the start of the web page.
- gfx::Range range;
+ // The range of the selection in the page (highlighted text).
+ gfx::Range range_;
+
+ // The highlighted text which is the portion of |text_| marked by |offset_|
+ // and |range_|. It will be an empty string if either |text_| or |range_|
+ // are empty of this selection information is invalid (i.e., |range_| does
+ // not cover any of |text_|.
+ base::string16 selected_text_;
- // The text inside and around the current selection range.
- base::string16 text;
+ // Part of the text on the page which includes the highlighted text plus
+ // possibly several characters before and after it.
+ base::string16 text_;
};
TextInputManager();

Powered by Google App Engine
This is Rietveld 408576698