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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 2891653003: [omnibox] Break out SetCaretPos() method and enhance browser test (Closed)
Patch Set: Better Mac call Created 3 years, 7 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: chrome/browser/ui/views/omnibox/omnibox_view_views.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
index 6add5dda5be118436629c2afa3534209146d6c72..a03b7960103b45608ee8c2ce2d14843dac095c59 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -429,6 +429,12 @@ void OmniboxViewViews::SetWindowTextAndCaretPos(const base::string16& text,
TextChanged();
}
+void OmniboxViewViews::SetCaretPos(size_t caret_pos) {
+ size_t pos = std::min(caret_pos, text().length());
Peter Kasting 2017/05/18 18:38:34 Nit: Is this actually necessary, or will SelectRan
Kevin Bailey 2017/05/18 19:48:17 It's not necessary. It's corrected way down in Ren
+ const gfx::Range range(pos, pos);
+ SelectRange(range);
Peter Kasting 2017/05/18 18:38:34 Nit: Or just SelectRange(gfx::Range(pos, pos));
Kevin Bailey 2017/05/18 19:48:17 Done.
+}
+
bool OmniboxViewViews::IsSelectAll() const {
// TODO(oshima): IME support.
return text() == GetSelectedText();

Powered by Google App Engine
This is Rietveld 408576698