| OLD | NEW |
| 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 "chrome/browser/ui/ash/chrome_shell_delegate.h" | 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| 11 #include "ash/accelerators/magnifier_key_scroller.h" | 11 #include "ash/accelerators/magnifier_key_scroller.h" |
| 12 #include "ash/accelerators/spoken_feedback_toggler.h" | 12 #include "ash/accelerators/spoken_feedback_toggler.h" |
| 13 #include "ash/aura/wm_window_aura.h" | |
| 14 #include "ash/common/accessibility_delegate.h" | 13 #include "ash/common/accessibility_delegate.h" |
| 15 #include "ash/common/accessibility_types.h" | 14 #include "ash/common/accessibility_types.h" |
| 16 #include "ash/common/session/session_state_delegate.h" | 15 #include "ash/common/session/session_state_delegate.h" |
| 17 #include "ash/common/wallpaper/wallpaper_delegate.h" | 16 #include "ash/common/wallpaper/wallpaper_delegate.h" |
| 18 #include "ash/common/wm/mru_window_tracker.h" | 17 #include "ash/common/wm/mru_window_tracker.h" |
| 19 #include "ash/common/wm/window_state.h" | 18 #include "ash/common/wm/window_state.h" |
| 20 #include "ash/common/wm_shell.h" | 19 #include "ash/common/wm_shell.h" |
| 20 #include "ash/common/wm_window.h" |
| 21 #include "ash/content/gpu_support_impl.h" | 21 #include "ash/content/gpu_support_impl.h" |
| 22 #include "ash/shell.h" | 22 #include "ash/shell.h" |
| 23 #include "ash/wm/window_util.h" | 23 #include "ash/wm/window_util.h" |
| 24 #include "base/command_line.h" | 24 #include "base/command_line.h" |
| 25 #include "base/macros.h" | 25 #include "base/macros.h" |
| 26 #include "base/memory/ptr_util.h" | 26 #include "base/memory/ptr_util.h" |
| 27 #include "build/build_config.h" | 27 #include "build/build_config.h" |
| 28 #include "chrome/browser/app_mode/app_mode_utils.h" | 28 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 29 #include "chrome/browser/chrome_notification_types.h" | 29 #include "chrome/browser/chrome_notification_types.h" |
| 30 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 30 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 namespace { | 82 namespace { |
| 83 | 83 |
| 84 const char kKeyboardShortcutHelpPageUrl[] = | 84 const char kKeyboardShortcutHelpPageUrl[] = |
| 85 "https://support.google.com/chromebook/answer/183101"; | 85 "https://support.google.com/chromebook/answer/183101"; |
| 86 | 86 |
| 87 void InitAfterFirstSessionStart() { | 87 void InitAfterFirstSessionStart() { |
| 88 // Restore focus after the user session is started. It's needed because some | 88 // Restore focus after the user session is started. It's needed because some |
| 89 // windows can be opened in background while login UI is still active because | 89 // windows can be opened in background while login UI is still active because |
| 90 // we currently restore browser windows before login UI is deleted. | 90 // we currently restore browser windows before login UI is deleted. |
| 91 aura::Window::Windows mru_list = ash::WmWindowAura::ToAuraWindows( | 91 aura::Window::Windows mru_list = ash::WmWindow::ToAuraWindows( |
| 92 ash::WmShell::Get()->mru_window_tracker()->BuildMruWindowList()); | 92 ash::WmShell::Get()->mru_window_tracker()->BuildMruWindowList()); |
| 93 if (!mru_list.empty()) | 93 if (!mru_list.empty()) |
| 94 mru_list.front()->Focus(); | 94 mru_list.front()->Focus(); |
| 95 | 95 |
| 96 // Enable magnifier scroll keys as there may be no mouse cursor in kiosk mode. | 96 // Enable magnifier scroll keys as there may be no mouse cursor in kiosk mode. |
| 97 ash::MagnifierKeyScroller::SetEnabled(chrome::IsRunningInForcedAppMode()); | 97 ash::MagnifierKeyScroller::SetEnabled(chrome::IsRunningInForcedAppMode()); |
| 98 | 98 |
| 99 // Enable long press action to toggle spoken feedback with hotrod | 99 // Enable long press action to toggle spoken feedback with hotrod |
| 100 // remote which can't handle shortcut. | 100 // remote which can't handle shortcut. |
| 101 ash::SpokenFeedbackToggler::SetEnabled(chrome::IsRunningInForcedAppMode()); | 101 ash::SpokenFeedbackToggler::SetEnabled(chrome::IsRunningInForcedAppMode()); |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 383 |
| 384 bool ChromeShellDelegate::IsIncognitoAllowed() const { | 384 bool ChromeShellDelegate::IsIncognitoAllowed() const { |
| 385 return AccessibilityManager::Get()->IsIncognitoAllowed(); | 385 return AccessibilityManager::Get()->IsIncognitoAllowed(); |
| 386 } | 386 } |
| 387 | 387 |
| 388 bool ChromeShellDelegate::IsRunningInForcedAppMode() const { | 388 bool ChromeShellDelegate::IsRunningInForcedAppMode() const { |
| 389 return chrome::IsRunningInForcedAppMode(); | 389 return chrome::IsRunningInForcedAppMode(); |
| 390 } | 390 } |
| 391 | 391 |
| 392 bool ChromeShellDelegate::CanShowWindowForUser(ash::WmWindow* window) const { | 392 bool ChromeShellDelegate::CanShowWindowForUser(ash::WmWindow* window) const { |
| 393 return ::CanShowWindowForUser(ash::WmWindowAura::GetAuraWindow(window), | 393 return ::CanShowWindowForUser(ash::WmWindow::GetAuraWindow(window), |
| 394 base::Bind(&GetActiveBrowserContext)); | 394 base::Bind(&GetActiveBrowserContext)); |
| 395 } | 395 } |
| 396 | 396 |
| 397 bool ChromeShellDelegate::IsForceMaximizeOnFirstRun() const { | 397 bool ChromeShellDelegate::IsForceMaximizeOnFirstRun() const { |
| 398 const user_manager::User* const user = | 398 const user_manager::User* const user = |
| 399 user_manager::UserManager::Get()->GetActiveUser(); | 399 user_manager::UserManager::Get()->GetActiveUser(); |
| 400 if (user) { | 400 if (user) { |
| 401 return chromeos::ProfileHelper::Get() | 401 return chromeos::ProfileHelper::Get() |
| 402 ->GetProfileByUser(user) | 402 ->GetProfileByUser(user) |
| 403 ->GetPrefs() | 403 ->GetPrefs() |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 NOTREACHED() << "Unexpected notification " << type; | 577 NOTREACHED() << "Unexpected notification " << type; |
| 578 } | 578 } |
| 579 } | 579 } |
| 580 | 580 |
| 581 void ChromeShellDelegate::PlatformInit() { | 581 void ChromeShellDelegate::PlatformInit() { |
| 582 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 582 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 583 content::NotificationService::AllSources()); | 583 content::NotificationService::AllSources()); |
| 584 registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED, | 584 registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED, |
| 585 content::NotificationService::AllSources()); | 585 content::NotificationService::AllSources()); |
| 586 } | 586 } |
| OLD | NEW |