From 39327261e00e51b28d6543e296772aed26eb40a6 Mon Sep 17 00:00:00 2001 From: "zork@chromium.org" Date: Wed, 30 Oct 2013 03:44:29 +0000 Subject: 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 --- ash/system/tray/system_tray.cc | 1 + ash/system/tray/system_tray_bubble.cc | 10 ++++++++++ ash/system/tray/system_tray_bubble.h | 3 +++ 3 files changed, 14 insertions(+) (limited to 'ash/system/tray') 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::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_; } -- cgit v1.1