| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_view.h" | 5 #include "ui/message_center/views/message_center_view.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 if (view_iter == notification_views_.end()) | 336 if (view_iter == notification_views_.end()) |
| 337 return; | 337 return; |
| 338 MessageView* view = view_iter->second; | 338 MessageView* view = view_iter->second; |
| 339 int index = message_list_view_->GetIndexOf(view); | 339 int index = message_list_view_->GetIndexOf(view); |
| 340 DCHECK_LE(0, index); | 340 DCHECK_LE(0, index); |
| 341 if (by_user) { | 341 if (by_user) { |
| 342 message_list_view_->SetRepositionTarget(view->bounds()); | 342 message_list_view_->SetRepositionTarget(view->bounds()); |
| 343 // Moves the keyboard focus to the next notification if the removed | 343 // Moves the keyboard focus to the next notification if the removed |
| 344 // notification is focused so that the user can dismiss notifications | 344 // notification is focused so that the user can dismiss notifications |
| 345 // without re-focusing by tab key. | 345 // without re-focusing by tab key. |
| 346 if (view->IsCloseButtonFocused() || | 346 if (view->IsCloseButtonFocused() || view->HasFocus()) { |
| 347 view == GetFocusManager()->GetFocusedView()) { | |
| 348 views::View* next_focused_view = NULL; | 347 views::View* next_focused_view = NULL; |
| 349 if (message_list_view_->child_count() > index + 1) | 348 if (message_list_view_->child_count() > index + 1) |
| 350 next_focused_view = message_list_view_->child_at(index + 1); | 349 next_focused_view = message_list_view_->child_at(index + 1); |
| 351 else if (index > 0) | 350 else if (index > 0) |
| 352 next_focused_view = message_list_view_->child_at(index - 1); | 351 next_focused_view = message_list_view_->child_at(index - 1); |
| 353 | 352 |
| 354 if (next_focused_view) { | 353 if (next_focused_view) { |
| 355 if (view->IsCloseButtonFocused()) { | 354 if (view->IsCloseButtonFocused()) { |
| 356 // Safe cast since all views in MessageListView are MessageViews. | 355 // Safe cast since all views in MessageListView are MessageViews. |
| 357 static_cast<MessageView*>( | 356 static_cast<MessageView*>( |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 // Disable the close-all button since no notification is visible. | 637 // Disable the close-all button since no notification is visible. |
| 639 button_bar_->SetCloseAllButtonEnabled(false); | 638 button_bar_->SetCloseAllButtonEnabled(false); |
| 640 } | 639 } |
| 641 } | 640 } |
| 642 | 641 |
| 643 void MessageCenterView::SetNotificationViewForTest(MessageView* view) { | 642 void MessageCenterView::SetNotificationViewForTest(MessageView* view) { |
| 644 message_list_view_->AddNotificationAt(view, 0); | 643 message_list_view_->AddNotificationAt(view, 0); |
| 645 } | 644 } |
| 646 | 645 |
| 647 } // namespace message_center | 646 } // namespace message_center |
| OLD | NEW |