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

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: Fix minor coding style issue. 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..34349bf533b89ea981c7ccf6f77acf112595d3e6 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,16 @@ bool OmniboxViewViews::HandleKeyReleaseEvent(const views::KeyEvent& event) {
return false;
}
+bool OmniboxViewViews::HandleMousePressEvent(const views::MouseEvent& event) {
+ if (!textfield_->HasFocus() && !textfield_->HasSelection()) {
+ textfield_->SelectAll();
+ textfield_->RequestFocus();
+ return true;
+ }
+
+ return false;
+}
+
void OmniboxViewViews::HandleFocusIn() {
// TODO(oshima): Get control key state.
model_->OnSetFocus(false);
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_views.h ('k') | views/controls/textfield/native_textfield_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698