Commit 91800dec authored by msw@chromium.org's avatar msw@chromium.org

Reorder View Textfield and Omnibox overrides.

Subclass overrides should match base class decls.
No other changes, just reordering functions.

BUG=131660
TEST=none
TBR=sky@chromium.org

Review URL: https://codereview.chromium.org/191783002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255857 0039d316-1c4b-4281-b951-d872f2087c98
parent 4f1f8694
......@@ -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.
......
......@@ -53,17 +53,17 @@ class OmniboxViewViews
void Init();
// views::Textfield:
virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE;
virtual const char* GetClassName() const OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE;
virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE;
virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
virtual bool OnKeyReleased(const ui::KeyEvent& event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE;
virtual bool SkipDefaultKeyEventProcessing(
const ui::KeyEvent& event) OVERRIDE;
virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE;
virtual void OnFocus() OVERRIDE;
virtual void OnBlur() OVERRIDE;
virtual base::string16 GetSelectionClipboardText() const OVERRIDE;
......
This diff is collapsed.
......@@ -178,26 +178,18 @@ class VIEWS_EXPORT Textfield : public View,
bool HasTextBeingDragged();
// View overrides:
// TODO(msw): Match declaration and definition order to View.
virtual int GetBaseline() const OVERRIDE;
virtual gfx::Size GetPreferredSize() OVERRIDE;
virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE;
virtual bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& e) OVERRIDE;
virtual void OnEnabledChanged() OVERRIDE;
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
virtual const char* GetClassName() const OVERRIDE;
virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE;
virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE;
virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE;
virtual void OnFocus() OVERRIDE;
virtual void OnBlur() OVERRIDE;
virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE;
virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
virtual ui::TextInputClient* GetTextInputClient() OVERRIDE;
virtual gfx::Point GetKeyboardContextMenuLocation() OVERRIDE;
virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE;
virtual const char* GetClassName() const OVERRIDE;
virtual gfx::NativeCursor GetCursor(const ui::MouseEvent& event) OVERRIDE;
virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
virtual void AboutToRequestFocusFromTabTraversal(bool reverse) OVERRIDE;
virtual bool SkipDefaultKeyEventProcessing(const ui::KeyEvent& e) OVERRIDE;
virtual bool GetDropFormats(
int* formats,
std::set<ui::OSExchangeData::CustomFormat>* custom_formats) OVERRIDE;
......@@ -206,9 +198,16 @@ class VIEWS_EXPORT Textfield : public View,
virtual void OnDragExited() OVERRIDE;
virtual int OnPerformDrop(const ui::DropTargetEvent& event) OVERRIDE;
virtual void OnDragDone() OVERRIDE;
virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE;
virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
virtual void OnEnabledChanged() OVERRIDE;
virtual void ViewHierarchyChanged(
const ViewHierarchyChangedDetails& details) OVERRIDE;
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
virtual void OnFocus() OVERRIDE;
virtual void OnBlur() OVERRIDE;
virtual gfx::Point GetKeyboardContextMenuLocation() OVERRIDE;
virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE;
// TextfieldModel::Delegate overrides:
virtual void OnCompositionTextConfirmedOrCleared() OVERRIDE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment