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

Side by Side Diff: ash/common/system/status_area_widget.cc

Issue 2295843006: Signin screen and locked screen status area focus advancing (Closed)
Patch Set: optimization Created 4 years, 3 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
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/status_area_widget.h" 5 #include "ash/common/system/status_area_widget.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/shelf/wm_shelf.h" 8 #include "ash/common/shelf/wm_shelf.h"
9 #include "ash/common/shell_window_ids.h" 9 #include "ash/common/shell_window_ids.h"
10 #include "ash/common/system/overview/overview_button_tray.h" 10 #include "ash/common/system/overview/overview_button_tray.h"
11 #include "ash/common/system/status_area_widget_delegate.h" 11 #include "ash/common/system/status_area_widget_delegate.h"
12 #include "ash/common/system/tray/system_tray.h" 12 #include "ash/common/system/tray/system_tray.h"
13 #include "ash/common/system/tray/system_tray_delegate.h" 13 #include "ash/common/system/tray/system_tray_delegate.h"
14 #include "ash/common/system/tray/system_tray_notifier.h"
14 #include "ash/common/system/web_notification/web_notification_tray.h" 15 #include "ash/common/system/web_notification/web_notification_tray.h"
15 #include "ash/common/wm_lookup.h" 16 #include "ash/common/wm_lookup.h"
16 #include "ash/common/wm_root_window_controller.h" 17 #include "ash/common/wm_root_window_controller.h"
17 #include "ash/common/wm_shell.h" 18 #include "ash/common/wm_shell.h"
18 #include "ash/common/wm_window.h" 19 #include "ash/common/wm_window.h"
19 #include "base/i18n/time_formatting.h" 20 #include "base/i18n/time_formatting.h"
20 #include "ui/native_theme/native_theme_dark_aura.h" 21 #include "ui/native_theme/native_theme_dark_aura.h"
22 #include "ui/views/focus/focus_manager.h"
21 23
22 #if defined(OS_CHROMEOS) 24 #if defined(OS_CHROMEOS)
23 #include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h" 25 #include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h"
24 #include "ash/common/system/chromeos/palette/palette_tray.h" 26 #include "ash/common/system/chromeos/palette/palette_tray.h"
25 #include "ash/common/system/chromeos/palette/palette_utils.h" 27 #include "ash/common/system/chromeos/palette/palette_utils.h"
26 #include "ash/common/system/chromeos/session/logout_button_tray.h" 28 #include "ash/common/system/chromeos/session/logout_button_tray.h"
27 #include "ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h" 29 #include "ash/common/system/chromeos/virtual_keyboard/virtual_keyboard_tray.h"
28 #include "ui/display/display.h" 30 #include "ui/display/display.h"
29 #endif 31 #endif
30 32
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 ? ui::NativeThemeDarkAura::instance() 215 ? ui::NativeThemeDarkAura::instance()
214 : Widget::GetNativeTheme(); 216 : Widget::GetNativeTheme();
215 } 217 }
216 218
217 void StatusAreaWidget::OnNativeWidgetActivationChanged(bool active) { 219 void StatusAreaWidget::OnNativeWidgetActivationChanged(bool active) {
218 Widget::OnNativeWidgetActivationChanged(active); 220 Widget::OnNativeWidgetActivationChanged(active);
219 if (active) 221 if (active)
220 status_area_widget_delegate_->SetPaneFocusAndFocusDefault(); 222 status_area_widget_delegate_->SetPaneFocusAndFocusDefault();
221 } 223 }
222 224
225 void StatusAreaWidget::OnKeyEvent(ui::KeyEvent* event) {
226 HandleFocusKeyEvent(event);
227 Widget::OnKeyEvent(event);
xiyuan 2016/09/12 18:19:09 nit: Skip if event->handled() is true.
228 }
229
223 void StatusAreaWidget::UpdateShelfItemBackground(int alpha) { 230 void StatusAreaWidget::UpdateShelfItemBackground(int alpha) {
224 web_notification_tray_->UpdateShelfItemBackground(alpha); 231 web_notification_tray_->UpdateShelfItemBackground(alpha);
225 system_tray_->UpdateShelfItemBackground(alpha); 232 system_tray_->UpdateShelfItemBackground(alpha);
226 #if defined(OS_CHROMEOS) 233 #if defined(OS_CHROMEOS)
227 virtual_keyboard_tray_->UpdateShelfItemBackground(alpha); 234 virtual_keyboard_tray_->UpdateShelfItemBackground(alpha);
228 logout_button_tray_->UpdateShelfItemBackground(alpha); 235 logout_button_tray_->UpdateShelfItemBackground(alpha);
229 ime_menu_tray_->UpdateShelfItemBackground(alpha); 236 ime_menu_tray_->UpdateShelfItemBackground(alpha);
230 if (palette_tray_) 237 if (palette_tray_)
231 palette_tray_->UpdateShelfItemBackground(alpha); 238 palette_tray_->UpdateShelfItemBackground(alpha);
232 #endif 239 #endif
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 300 }
294 return false; 301 return false;
295 } 302 }
296 #endif 303 #endif
297 304
298 void StatusAreaWidget::AddOverviewButtonTray() { 305 void StatusAreaWidget::AddOverviewButtonTray() {
299 overview_button_tray_ = new OverviewButtonTray(wm_shelf_); 306 overview_button_tray_ = new OverviewButtonTray(wm_shelf_);
300 status_area_widget_delegate_->AddTray(overview_button_tray_); 307 status_area_widget_delegate_->AddTray(overview_button_tray_);
301 } 308 }
302 309
310 void StatusAreaWidget::HandleFocusKeyEvent(ui::KeyEvent* event) {
311 WmShell* wm_shell = WmShell::Get();
312 LoginStatus status = wm_shell->system_tray_delegate()->GetUserLoginStatus();
313 bool is_tab_pressed = event->type() == ui::ET_KEY_PRESSED &&
314 views::FocusManager::IsTabTraversalKeyEvent(*event);
315 views::FocusManager* focus_manager = GetFocusManager();
316 if ((status != LoginStatus::NOT_LOGGED_IN && status != LoginStatus::LOCKED) ||
317 !is_tab_pressed || !focus_manager) {
318 return;
319 }
320
321 bool reverse = event->IsShiftDown();
322 views::View* next_focusable_view = focus_manager->GetNextFocusableView(
323 focus_manager->GetFocusedView(), nullptr, reverse, false);
324 if (system_tray_ && system_tray_->visible() &&
325 system_tray_->Contains(next_focusable_view)) {
326 wm_shell->system_tray_notifier()->NotifyWillReturnFocusToWebContents(
327 reverse);
328 event->SetHandled();
329 }
330 }
331
303 } // namespace ash 332 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698