Commit b668c72c authored by Caroline Rising's avatar Caroline Rising Committed by Commit Bot

Create public function to get if AccessiblePaneView has focus.

This is used to see if the tab strip has focus for showing tab hover cards during keyboard navigation. This is a follow up to https://chromium-review.googlesource.com/c/chromium/src/+/1612220

Bug: 963537
Change-Id: I8d684255c42007012f599b8a13d6a0fda76665d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1613927Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Reviewed-by: default avatarDana Fried <dfried@chromium.org>
Commit-Queue: Caroline Rising <corising@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660942}
parent 046cfb5a
...@@ -143,7 +143,7 @@ class TabHoverCardEventSniffer : public ui::EventHandler { ...@@ -143,7 +143,7 @@ class TabHoverCardEventSniffer : public ui::EventHandler {
protected: protected:
// ui::EventTarget: // ui::EventTarget:
void OnKeyEvent(ui::KeyEvent* event) override { void OnKeyEvent(ui::KeyEvent* event) override {
if (!TabStripIsKeyboardFocused()) if (!tab_strip_->pane_has_focus())
hover_card_->FadeOutToHide(); hover_card_->FadeOutToHide();
} }
...@@ -153,10 +153,6 @@ class TabHoverCardEventSniffer : public ui::EventHandler { ...@@ -153,10 +153,6 @@ class TabHoverCardEventSniffer : public ui::EventHandler {
} }
private: private:
bool TabStripIsKeyboardFocused() {
return tab_strip_->GetPaneFocusTraversable() != nullptr;
}
TabHoverCardBubbleView* const hover_card_; TabHoverCardBubbleView* const hover_card_;
TabStrip* tab_strip_; TabStrip* tab_strip_;
views::Widget* widget_; views::Widget* widget_;
......
...@@ -35,6 +35,8 @@ class VIEWS_EXPORT AccessiblePaneView : public View, ...@@ -35,6 +35,8 @@ class VIEWS_EXPORT AccessiblePaneView : public View,
// the pane was able to receive focus. // the pane was able to receive focus.
virtual bool SetPaneFocus(View* initial_focus); virtual bool SetPaneFocus(View* initial_focus);
bool pane_has_focus() const { return pane_has_focus_; }
// Set focus to the pane with complete keyboard access, with the // Set focus to the pane with complete keyboard access, with the
// focus initially set to the default child. Focus will be restored // focus initially set to the default child. Focus will be restored
// to the last focused view if the user escapes. // to the last focused view if the user escapes.
......
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