diff options
author | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-30 03:44:29 +0000 |
---|---|---|
committer | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-30 03:44:29 +0000 |
commit | 39327261e00e51b28d6543e296772aed26eb40a6 (patch) | |
tree | 3b8a52beda260d4cbf4346b8c8ed83c68ad39a1b /ash/system/tray | |
parent | 0b5a0d2bd02780f7a37c8c5b56e19a51000f1f1e (diff) | |
download | chromium_src-39327261e00e51b28d6543e296772aed26eb40a6.zip chromium_src-39327261e00e51b28d6543e296772aed26eb40a6.tar.gz chromium_src-39327261e00e51b28d6543e296772aed26eb40a6.tar.bz2 |
Focus the default item when the system tray bubble is created
BUG=304304
Review URL: https://codereview.chromium.org/49003009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231729 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/system/tray')
-rw-r--r-- | ash/system/tray/system_tray.cc | 1 | ||||
-rw-r--r-- | ash/system/tray/system_tray_bubble.cc | 10 | ||||
-rw-r--r-- | ash/system/tray/system_tray_bubble.h | 3 |
3 files changed, 14 insertions, 0 deletions
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc index e63acc6..769eb03 100644 --- a/ash/system/tray/system_tray.cc +++ b/ash/system/tray/system_tray.cc @@ -99,6 +99,7 @@ class SystemBubbleWrapper { views::BubbleBorder::PAINT_NONE); } is_persistent_ = is_persistent; + bubble_->FocusDefault(); } // Convenience accessors: diff --git a/ash/system/tray/system_tray_bubble.cc b/ash/system/tray/system_tray_bubble.cc index 3477c3c..362e996 100644 --- a/ash/system/tray/system_tray_bubble.cc +++ b/ash/system/tray/system_tray_bubble.cc @@ -271,6 +271,16 @@ void SystemTrayBubble::InitView(views::View* anchor, } } +void SystemTrayBubble::FocusDefault() { + views::FocusManager* manager = bubble_view_->GetFocusManager(); + if (!manager) + return; + + views::View* view = manager->GetNextFocusableView(NULL, NULL, false, false); + if (view) + view->RequestFocus(); +} + void SystemTrayBubble::DestroyItemViews() { for (std::vector<ash::SystemTrayItem*>::iterator it = items_.begin(); it != items_.end(); diff --git a/ash/system/tray/system_tray_bubble.h b/ash/system/tray/system_tray_bubble.h index 61b1543..7232805 100644 --- a/ash/system/tray/system_tray_bubble.h +++ b/ash/system/tray/system_tray_bubble.h @@ -43,6 +43,9 @@ class SystemTrayBubble { user::LoginStatus login_status, views::TrayBubbleView::InitParams* init_params); + // Focus the default item. + void FocusDefault(); + BubbleType bubble_type() const { return bubble_type_; } views::TrayBubbleView* bubble_view() const { return bubble_view_; } |