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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/message_center/views/message_center_bubble.h" 5 #include "ui/message_center/views/message_center_bubble.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "ui/base/l10n/l10n_util.h" 8 #include "ui/base/l10n/l10n_util.h"
9 #include "ui/message_center/message_center_style.h" 9 #include "ui/message_center/message_center_style.h"
10 #include "ui/message_center/views/message_center_view.h" 10 #include "ui/message_center/views/message_center_view.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 message_center_view_ = new MessageCenterView( 100 message_center_view_ = new MessageCenterView(
101 message_center(), tray(), max_height(), initially_settings_visible_, 101 message_center(), tray(), max_height(), initially_settings_visible_,
102 false); /* MessageCenterBubble should be used only on ChromeOS. 102 false); /* MessageCenterBubble should be used only on ChromeOS.
103 Message center is never shown top down in ChromeOS. */ 103 Message center is never shown top down in ChromeOS. */
104 bubble_view()->AddChildView(new ContentsView(this, message_center_view_)); 104 bubble_view()->AddChildView(new ContentsView(this, message_center_view_));
105 // Resize the content of the bubble view to the given bubble size. This is 105 // Resize the content of the bubble view to the given bubble size. This is
106 // necessary in case of the bubble border forcing a bigger size then the 106 // necessary in case of the bubble border forcing a bigger size then the
107 // |new_bubble_view| actually wants. See crbug.com/169390. 107 // |new_bubble_view| actually wants. See crbug.com/169390.
108 bubble_view()->Layout(); 108 bubble_view()->Layout();
109 UpdateBubbleView(); 109 UpdateBubbleView();
110 bubble_view() 110 views::FocusManager* focus_manager = bubble_view()->GetFocusManager();
111 ->GetFocusManager() 111 // new_bubble_view should be a top level view and have a focus manager.
112 ->GetNextFocusableView(nullptr, nullptr, false, false) 112 DCHECK(focus_manager);
113 ->RequestFocus(); 113 views::View* next_focusable_view = focus_manager
114 ->GetNextFocusableView(nullptr, nullptr, false, false);
115 // The bubble may not have any focusable view (eg. on lock screen). In such
116 // case, |next_focusable_view| is null.
117 if (next_focusable_view)
118 next_focusable_view->RequestFocus();
114 } 119 }
115 120
116 void MessageCenterBubble::OnBubbleViewDestroyed() { 121 void MessageCenterBubble::OnBubbleViewDestroyed() {
117 message_center_view_ = NULL; 122 message_center_view_ = NULL;
118 } 123 }
119 124
120 void MessageCenterBubble::UpdateBubbleView() { 125 void MessageCenterBubble::UpdateBubbleView() {
121 if (!bubble_view()) 126 if (!bubble_view())
122 return; // Could get called after view is closed 127 return; // Could get called after view is closed
123 const NotificationList::Notifications& notifications = 128 const NotificationList::Notifications& notifications =
(...skipping 14 matching lines...) Expand all
138 } 143 }
139 144
140 void MessageCenterBubble::OnMouseExitedView() { 145 void MessageCenterBubble::OnMouseExitedView() {
141 } 146 }
142 147
143 size_t MessageCenterBubble::NumMessageViewsForTest() const { 148 size_t MessageCenterBubble::NumMessageViewsForTest() const {
144 return message_center_view_->NumMessageViewsForTest(); 149 return message_center_view_->NumMessageViewsForTest();
145 } 150 }
146 151
147 } // namespace message_center 152 } // namespace message_center
OLDNEW
« 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