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

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

Issue 191783002: Reorder View Textfield and Omnibox overrides. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_views.h ('k') | ui/views/controls/textfield/textfield.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bd87afac6a8d34b6a69b836d89810803527850a5..5d76d3bcc6788f52cea0a4cc688b53920adff064 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -183,48 +183,10 @@ void OmniboxViewViews::Init() {
////////////////////////////////////////////////////////////////////////////////
// OmniboxViewViews, views::Textfield implementation:
-void OmniboxViewViews::AboutToRequestFocusFromTabTraversal(bool reverse) {
- if (chrome::GetOriginChipV2HideTrigger() ==
- chrome::ORIGIN_CHIP_V2_HIDE_ON_MOUSE_RELEASE) {
- controller()->GetToolbarModel()->set_origin_chip_enabled(false);
- controller()->OnChanged();
- }
-}
-
const char* OmniboxViewViews::GetClassName() const {
return kViewClassName;
}
-void OmniboxViewViews::OnGestureEvent(ui::GestureEvent* event) {
- if (!HasFocus() && event->type() == ui::ET_GESTURE_TAP_DOWN) {
- select_all_on_gesture_tap_ = true;
-
- // If we're trying to select all on tap, invalidate any saved selection lest
- // restoring it fights with the "select all" action.
- saved_selection_for_focus_change_ = gfx::Range::InvalidRange();
- }
-
- if (select_all_on_gesture_tap_ && event->type() == ui::ET_GESTURE_TAP)
- SelectAll(false);
-
- if (event->type() == ui::ET_GESTURE_TAP ||
- event->type() == ui::ET_GESTURE_TAP_CANCEL ||
- event->type() == ui::ET_GESTURE_TWO_FINGER_TAP ||
- event->type() == ui::ET_GESTURE_SCROLL_BEGIN ||
- event->type() == ui::ET_GESTURE_PINCH_BEGIN ||
- event->type() == ui::ET_GESTURE_LONG_PRESS ||
- event->type() == ui::ET_GESTURE_LONG_TAP) {
- select_all_on_gesture_tap_ = false;
- }
-
- views::Textfield::OnGestureEvent(event);
-}
-
-void OmniboxViewViews::GetAccessibleState(ui::AXViewState* state) {
- location_bar_view_->GetAccessibleState(state);
- state->role = ui::AX_ROLE_TEXT_FIELD;
-}
-
bool OmniboxViewViews::OnMousePressed(const ui::MouseEvent& event) {
select_all_on_mouse_release_ =
(event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) &&
@@ -349,6 +311,39 @@ bool OmniboxViewViews::OnKeyReleased(const ui::KeyEvent& event) {
return views::Textfield::OnKeyReleased(event);
}
+void OmniboxViewViews::OnGestureEvent(ui::GestureEvent* event) {
+ if (!HasFocus() && event->type() == ui::ET_GESTURE_TAP_DOWN) {
+ select_all_on_gesture_tap_ = true;
+
+ // If we're trying to select all on tap, invalidate any saved selection lest
+ // restoring it fights with the "select all" action.
+ saved_selection_for_focus_change_ = gfx::Range::InvalidRange();
+ }
+
+ if (select_all_on_gesture_tap_ && event->type() == ui::ET_GESTURE_TAP)
+ SelectAll(false);
+
+ if (event->type() == ui::ET_GESTURE_TAP ||
+ event->type() == ui::ET_GESTURE_TAP_CANCEL ||
+ event->type() == ui::ET_GESTURE_TWO_FINGER_TAP ||
+ event->type() == ui::ET_GESTURE_SCROLL_BEGIN ||
+ event->type() == ui::ET_GESTURE_PINCH_BEGIN ||
+ event->type() == ui::ET_GESTURE_LONG_PRESS ||
+ event->type() == ui::ET_GESTURE_LONG_TAP) {
+ select_all_on_gesture_tap_ = false;
+ }
+
+ views::Textfield::OnGestureEvent(event);
+}
+
+void OmniboxViewViews::AboutToRequestFocusFromTabTraversal(bool reverse) {
+ if (chrome::GetOriginChipV2HideTrigger() ==
+ chrome::ORIGIN_CHIP_V2_HIDE_ON_MOUSE_RELEASE) {
+ controller()->GetToolbarModel()->set_origin_chip_enabled(false);
+ controller()->OnChanged();
+ }
+}
+
bool OmniboxViewViews::SkipDefaultKeyEventProcessing(
const ui::KeyEvent& event) {
if (views::FocusManager::IsTabTraversalKeyEvent(event) &&
@@ -359,6 +354,11 @@ bool OmniboxViewViews::SkipDefaultKeyEventProcessing(
return Textfield::SkipDefaultKeyEventProcessing(event);
}
+void OmniboxViewViews::GetAccessibleState(ui::AXViewState* state) {
+ location_bar_view_->GetAccessibleState(state);
+ state->role = ui::AX_ROLE_TEXT_FIELD;
+}
+
bool OmniboxViewViews::HandleEarlyTabActions(const ui::KeyEvent& event) {
// This must run before acclerator handling invokes a focus change on tab.
// Note the parallel with SkipDefaultKeyEventProcessing above.
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_views.h ('k') | ui/views/controls/textfield/textfield.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698