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

Unified Diff: ui/message_center/views/message_center_bubble.cc

Issue 2124093003: Fix crash on clicking the web notification tray (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/views/message_center_bubble.cc
diff --git a/ui/message_center/views/message_center_bubble.cc b/ui/message_center/views/message_center_bubble.cc
index c65587b2537f1906159a3772a49b0ae6fc717bdc..8b1b7705c649f78591864a4e2f11e44a714fd3a0 100644
--- a/ui/message_center/views/message_center_bubble.cc
+++ b/ui/message_center/views/message_center_bubble.cc
@@ -107,10 +107,15 @@ void MessageCenterBubble::InitializeContents(
// |new_bubble_view| actually wants. See crbug.com/169390.
bubble_view()->Layout();
UpdateBubbleView();
- bubble_view()
- ->GetFocusManager()
- ->GetNextFocusableView(nullptr, nullptr, false, false)
- ->RequestFocus();
+ views::FocusManager* focus_manager = bubble_view()->GetFocusManager();
+ // new_bubble_view should be a top level view and have a focus manager.
+ DCHECK(focus_manager);
+ views::View* next_focusable_view = focus_manager
+ ->GetNextFocusableView(nullptr, nullptr, false, false);
+ // The bubble may not have any focusable view (eg. on lock screen). In such
+ // case, |next_focusable_view| is null.
+ if (next_focusable_view)
+ next_focusable_view->RequestFocus();
}
void MessageCenterBubble::OnBubbleViewDestroyed() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698