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

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

Issue 8527015: Fix omnibox mouse click highlight/word select/focus issue in aura build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 f6212641d21c8a69135c2e723696fee42ff51a16..5b0c8ea1caa36c526a786090442dd36adfeeb56a 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -28,6 +28,7 @@
#include "ui/gfx/render_text.h"
#include "views/border.h"
#include "views/controls/textfield/textfield.h"
+#include "views/events/event.h"
#include "views/layout/fill_layout.h"
#if defined(TOUCH_UI)
@@ -79,6 +80,10 @@ class AutocompleteTextfield : public views::Textfield {
return views::View::IsFocusable();
}
+ virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE {
+ return omnibox_view_->HandleMousePressEvent(event);
+ }
+
private:
OmniboxViewViews* omnibox_view_;
@@ -266,6 +271,17 @@ bool OmniboxViewViews::HandleKeyReleaseEvent(const views::KeyEvent& event) {
return false;
}
+bool OmniboxViewViews::HandleMousePressEvent(const views::MouseEvent& event) {
+ if (event.IsOnlyLeftMouseButton() && !textfield_->HasFocus() &&
msw 2011/11/11 01:28:58 We might want to do this for right mouse too. On W
jennyz 2011/11/12 01:50:17 Done.
+ !textfield_->HasSelection()) {
+ textfield_->SelectAll();
+ textfield_->RequestFocus();
+ return true;
+ }
+
+ return false;
+}
+
void OmniboxViewViews::HandleFocusIn() {
// TODO(oshima): Get control key state.
model_->OnSetFocus(false);

Powered by Google App Engine
This is Rietveld 408576698