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

Side by Side Diff: ash/common/system/tray/tray_details_view.cc

Issue 2434553003: [Ash MD] Restore focus on detailed row when exiting detailed view (Closed)
Patch Set: Created 4 years, 2 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 | ash/common/system/tray/tray_details_view_unittest.cc » ('j') | 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 "ash/common/system/tray/tray_details_view.h" 5 #include "ash/common/system/tray/tray_details_view.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/system/tray/fixed_sized_scroll_view.h" 8 #include "ash/common/system/tray/fixed_sized_scroll_view.h"
9 #include "ash/common/system/tray/system_tray.h" 9 #include "ash/common/system/tray/system_tray.h"
10 #include "ash/common/system/tray/system_tray_item.h" 10 #include "ash/common/system/tray/system_tray_item.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // TODO(tdanderson): Store login status as a member in TrayDetailsView 161 // TODO(tdanderson): Store login status as a member in TrayDetailsView
162 // instead of its derived classes. Use this to perform an early return 162 // instead of its derived classes. Use this to perform an early return
163 // if launching WebUI settings is not permitted, and provide a default 163 // if launching WebUI settings is not permitted, and provide a default
164 // implementation to ShowSettings(). 164 // implementation to ShowSettings().
165 } 165 }
166 166
167 void TrayDetailsView::TransitionToDefaultView() { 167 void TrayDetailsView::TransitionToDefaultView() {
168 // Cache pointer to owner in this function scope. TrayDetailsView will be 168 // Cache pointer to owner in this function scope. TrayDetailsView will be
169 // deleted after called ShowDefaultView. 169 // deleted after called ShowDefaultView.
170 SystemTrayItem* owner = owner_; 170 SystemTrayItem* owner = owner_;
171 if (title_row_ && title_row_->content() && title_row_->content()->HasFocus()) 171 if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
varkha 2016/10/20 15:34:38 Did you not merge this with the else if condition
172 owner->set_restore_focus(true); 172 if (back_button_ && back_button_->HasFocus())
173 owner->set_restore_focus(true);
174 } else {
175 if (title_row_ && title_row_->content() &&
176 title_row_->content()->HasFocus()) {
177 owner->set_restore_focus(true);
178 }
179 }
173 owner->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING); 180 owner->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING);
174 owner->set_restore_focus(false); 181 owner->set_restore_focus(false);
175 } 182 }
176 183
177 void TrayDetailsView::Layout() { 184 void TrayDetailsView::Layout() {
178 if (bounds().IsEmpty()) { 185 if (bounds().IsEmpty()) {
179 views::View::Layout(); 186 views::View::Layout();
180 return; 187 return;
181 } 188 }
182 189
(...skipping 26 matching lines...) Expand all
209 if (index < child_count() - 1 && child_at(index + 1) != title_row_) 216 if (index < child_count() - 1 && child_at(index + 1) != title_row_)
210 scroll_border_->set_visible(true); 217 scroll_border_->set_visible(true);
211 else 218 else
212 scroll_border_->set_visible(false); 219 scroll_border_->set_visible(false);
213 } 220 }
214 221
215 views::View::OnPaintBorder(canvas); 222 views::View::OnPaintBorder(canvas);
216 } 223 }
217 224
218 } // namespace ash 225 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/system/tray/tray_details_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698