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

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: rebase 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 void TrayDetailsView::HandleButtonPressed(views::Button* sender, 147 void TrayDetailsView::HandleButtonPressed(views::Button* sender,
148 const ui::Event& event) {} 148 const ui::Event& event) {}
149 149
150 void TrayDetailsView::CreateExtraTitleRowButtons() {} 150 void TrayDetailsView::CreateExtraTitleRowButtons() {}
151 151
152 void TrayDetailsView::TransitionToDefaultView() { 152 void TrayDetailsView::TransitionToDefaultView() {
153 // Cache pointer to owner in this function scope. TrayDetailsView will be 153 // Cache pointer to owner in this function scope. TrayDetailsView will be
154 // deleted after called ShowDefaultView. 154 // deleted after called ShowDefaultView.
155 SystemTrayItem* owner = owner_; 155 SystemTrayItem* owner = owner_;
156 if (title_row_ && title_row_->content() && title_row_->content()->HasFocus()) 156 if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
157 owner->set_restore_focus(true); 157 if (back_button_ && back_button_->HasFocus())
158 owner->set_restore_focus(true);
159 } else {
160 if (title_row_ && title_row_->content() &&
161 title_row_->content()->HasFocus()) {
162 owner->set_restore_focus(true);
163 }
164 }
158 owner->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING); 165 owner->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING);
159 owner->set_restore_focus(false); 166 owner->set_restore_focus(false);
160 } 167 }
161 168
162 void TrayDetailsView::Layout() { 169 void TrayDetailsView::Layout() {
163 if (bounds().IsEmpty()) { 170 if (bounds().IsEmpty()) {
164 views::View::Layout(); 171 views::View::Layout();
165 return; 172 return;
166 } 173 }
167 174
(...skipping 26 matching lines...) Expand all
194 if (index < child_count() - 1 && child_at(index + 1) != title_row_) 201 if (index < child_count() - 1 && child_at(index + 1) != title_row_)
195 scroll_border_->set_visible(true); 202 scroll_border_->set_visible(true);
196 else 203 else
197 scroll_border_->set_visible(false); 204 scroll_border_->set_visible(false);
198 } 205 }
199 206
200 views::View::OnPaintBorder(canvas); 207 views::View::OnPaintBorder(canvas);
201 } 208 }
202 209
203 } // namespace ash 210 } // 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