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

Side by Side Diff: ui/message_center/views/message_center_view.cc

Issue 108063004: Give up focus if the focused view becomes unfocusable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Extracted to common code into FocusManager class Created 7 years 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 | Annotate | Revision Log
OLDNEW
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/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 // |focus_manager| can be NULL in tests. 1022 // |focus_manager| can be NULL in tests.
1023 if (focus_manager) 1023 if (focus_manager)
1024 focused_view = focus_manager->GetFocusedView(); 1024 focused_view = focus_manager->GetFocusedView();
1025 1025
1026 // All the children of this view are owned by |this|. 1026 // All the children of this view are owned by |this|.
1027 scroller_->contents()->RemoveAllChildViews(/*delete_children=*/false); 1027 scroller_->contents()->RemoveAllChildViews(/*delete_children=*/false);
1028 scroller_->contents()->AddChildView( 1028 scroller_->contents()->AddChildView(
1029 no_message_views ? empty_list_view_.get() : message_list_view_.get()); 1029 no_message_views ? empty_list_view_.get() : message_list_view_.get());
1030 1030
1031 button_bar_->SetCloseAllButtonEnabled(!no_message_views); 1031 button_bar_->SetCloseAllButtonEnabled(!no_message_views);
1032 scroller_->set_focusable(!no_message_views); 1032 scroller_->SetFocusable(!no_message_views);
1033 1033
1034 if (focus_manager && focused_view) 1034 if (focus_manager && focused_view)
1035 focus_manager->SetFocusedView(focused_view); 1035 focus_manager->SetFocusedView(focused_view);
1036 1036
1037 scroller_->InvalidateLayout(); 1037 scroller_->InvalidateLayout();
1038 PreferredSizeChanged(); 1038 PreferredSizeChanged();
1039 Layout(); 1039 Layout();
1040 } 1040 }
1041 1041
1042 void MessageCenterView::SetNotificationViewForTest(MessageView* view) { 1042 void MessageCenterView::SetNotificationViewForTest(MessageView* view) {
1043 message_list_view_->AddNotificationAt(view, 0); 1043 message_list_view_->AddNotificationAt(view, 0);
1044 } 1044 }
1045 1045
1046 } // namespace message_center 1046 } // namespace message_center
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698