Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / ash / chrome_shell_delegate_chromeos.cc
index 9853ac8..64e0cbd 100644 (file)
@@ -4,6 +4,8 @@
 
 #include "chrome/browser/ui/ash/chrome_shell_delegate.h"
 
+#include "ash/accelerators/magnifier_key_scroller.h"
+#include "ash/accelerators/spoken_feedback_toggler.h"
 #include "ash/accessibility_delegate.h"
 #include "ash/media_delegate.h"
 #include "ash/wm/mru_window_tracker.h"
@@ -11,6 +13,7 @@
 #include "base/command_line.h"
 #include "base/prefs/pref_service.h"
 #include "chrome/browser/accessibility/accessibility_events.h"
+#include "chrome/browser/app_mode/app_mode_utils.h"
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
 
 namespace {
 
-// This function is used for restoring focus after the user session is started.
-// It's needed because some windows can be opened in background while login UI
-// is still active because we currently restore browser windows before login UI
-// is deleted.
-void RestoreFocus() {
+void InitAfterSessionStart() {
+  // Restor focus after the user session is started.  It's needed
+  // because some windows can be opened in background while login UI
+  // is still active because we currently restore browser windows
+  // before login UI is deleted.
+  ash::Shell* shell = ash::Shell::GetInstance();
   ash::MruWindowTracker::WindowList mru_list =
-      ash::Shell::GetInstance()->mru_window_tracker()->BuildMruWindowList();
+      shell->mru_window_tracker()->BuildMruWindowList();
   if (!mru_list.empty())
     mru_list.front()->Focus();
+
+  // Enable magnifier scroll keys as there may be no mouse cursor in
+  // kiosk mode.
+  ash::MagnifierKeyScroller::SetEnabled(chrome::IsRunningInForcedAppMode());
+
+  // Enable long press action to toggle spoken feedback with hotrod
+  // remote which can't handle shortcut.
+  ash::SpokenFeedbackToggler::SetEnabled(chrome::IsRunningInForcedAppMode());
 }
 
 class AccessibilityDelegateImpl : public ash::AccessibilityDelegate {
@@ -119,6 +131,17 @@ class AccessibilityDelegateImpl : public ash::AccessibilityDelegate {
     return chromeos::AccessibilityManager::Get()->IsAutoclickEnabled();
   }
 
+  virtual void SetVirtualKeyboardEnabled(bool enabled) OVERRIDE {
+    DCHECK(chromeos::AccessibilityManager::Get());
+    return chromeos::AccessibilityManager::Get()->
+        EnableVirtualKeyboard(enabled);
+  }
+
+  virtual bool IsVirtualKeyboardEnabled() const OVERRIDE {
+    DCHECK(chromeos::AccessibilityManager::Get());
+    return chromeos::AccessibilityManager::Get()->IsVirtualKeyboardEnabled();
+  }
+
   virtual bool ShouldShowAccessibilityMenu() const OVERRIDE {
     DCHECK(chromeos::AccessibilityManager::Get());
     return chromeos::AccessibilityManager::Get()->
@@ -258,7 +281,7 @@ void ChromeShellDelegate::Observe(int type,
       ash::Shell::GetInstance()->OnLoginUserProfilePrepared();
       break;
     case chrome::NOTIFICATION_SESSION_STARTED:
-      RestoreFocus();
+      InitAfterSessionStart();
       ash::Shell::GetInstance()->ShowShelf();
       break;
     case chrome::NOTIFICATION_APP_TERMINATING: