| 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 "ash/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 #include "ui/views/view_model_utils.h" | 69 #include "ui/views/view_model_utils.h" |
| 70 #include "ui/wm/core/capture_controller.h" | 70 #include "ui/wm/core/capture_controller.h" |
| 71 #include "ui/wm/core/easy_resize_window_targeter.h" | 71 #include "ui/wm/core/easy_resize_window_targeter.h" |
| 72 #include "ui/wm/core/visibility_controller.h" | 72 #include "ui/wm/core/visibility_controller.h" |
| 73 #include "ui/wm/core/window_util.h" | 73 #include "ui/wm/core/window_util.h" |
| 74 #include "ui/wm/public/drag_drop_client.h" | 74 #include "ui/wm/public/drag_drop_client.h" |
| 75 #include "ui/wm/public/tooltip_client.h" | 75 #include "ui/wm/public/tooltip_client.h" |
| 76 #include "ui/wm/public/window_types.h" | 76 #include "ui/wm/public/window_types.h" |
| 77 | 77 |
| 78 #if defined(OS_CHROMEOS) | 78 #if defined(OS_CHROMEOS) |
| 79 #include "ash/system/tray_accessibility.h" | 79 #include "ash/ash_touch_exploration_manager_chromeos.h" |
| 80 #include "ash/wm/boot_splash_screen_chromeos.h" | 80 #include "ash/wm/boot_splash_screen_chromeos.h" |
| 81 #include "ui/chromeos/touch_exploration_controller.h" | 81 #include "ui/chromeos/touch_exploration_controller.h" |
| 82 #endif | 82 #endif |
| 83 | 83 |
| 84 namespace ash { | 84 namespace ash { |
| 85 namespace { | 85 namespace { |
| 86 | 86 |
| 87 #if defined(OS_CHROMEOS) | 87 #if defined(OS_CHROMEOS) |
| 88 // Duration for the animation that hides the boot splash screen, in | 88 // Duration for the animation that hides the boot splash screen, in |
| 89 // milliseconds. This should be short enough in relation to | 89 // milliseconds. This should be short enough in relation to |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 } | 254 } |
| 255 virtual bool HasHitTestMask() const OVERRIDE { | 255 virtual bool HasHitTestMask() const OVERRIDE { |
| 256 return false; | 256 return false; |
| 257 } | 257 } |
| 258 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {} | 258 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {} |
| 259 | 259 |
| 260 private: | 260 private: |
| 261 DISALLOW_COPY_AND_ASSIGN(EmptyWindowDelegate); | 261 DISALLOW_COPY_AND_ASSIGN(EmptyWindowDelegate); |
| 262 }; | 262 }; |
| 263 | 263 |
| 264 #if defined(OS_CHROMEOS) | |
| 265 // Responsible for initializing TouchExplorationController when spoken | |
| 266 // feedback is on. | |
| 267 class CrosAccessibilityObserver : public AccessibilityObserver { | |
| 268 public: | |
| 269 explicit CrosAccessibilityObserver( | |
| 270 RootWindowController* root_window_controller) | |
| 271 : root_window_controller_(root_window_controller) { | |
| 272 Shell::GetInstance()->system_tray_notifier()-> | |
| 273 AddAccessibilityObserver(this); | |
| 274 UpdateTouchExplorationState(); | |
| 275 } | |
| 276 | |
| 277 virtual ~CrosAccessibilityObserver() { | |
| 278 SystemTrayNotifier* system_tray_notifier = | |
| 279 Shell::GetInstance()->system_tray_notifier(); | |
| 280 if (system_tray_notifier) | |
| 281 system_tray_notifier->RemoveAccessibilityObserver(this); | |
| 282 } | |
| 283 | |
| 284 private: | |
| 285 void UpdateTouchExplorationState() { | |
| 286 AccessibilityDelegate* delegate = | |
| 287 Shell::GetInstance()->accessibility_delegate(); | |
| 288 bool enabled = delegate->IsSpokenFeedbackEnabled(); | |
| 289 | |
| 290 if (enabled && !touch_exploration_controller_.get()) { | |
| 291 touch_exploration_controller_.reset( | |
| 292 new ui::TouchExplorationController( | |
| 293 root_window_controller_->GetRootWindow())); | |
| 294 } else if (!enabled) { | |
| 295 touch_exploration_controller_.reset(); | |
| 296 } | |
| 297 } | |
| 298 | |
| 299 // Overridden from AccessibilityObserver. | |
| 300 virtual void OnAccessibilityModeChanged( | |
| 301 AccessibilityNotificationVisibility notify) OVERRIDE { | |
| 302 UpdateTouchExplorationState(); | |
| 303 } | |
| 304 | |
| 305 scoped_ptr<ui::TouchExplorationController> touch_exploration_controller_; | |
| 306 RootWindowController* root_window_controller_; | |
| 307 | |
| 308 DISALLOW_COPY_AND_ASSIGN(CrosAccessibilityObserver); | |
| 309 }; | |
| 310 #endif // OS_CHROMEOS | |
| 311 | |
| 312 } // namespace | 264 } // namespace |
| 313 | 265 |
| 314 void RootWindowController::CreateForPrimaryDisplay(AshWindowTreeHost* host) { | 266 void RootWindowController::CreateForPrimaryDisplay(AshWindowTreeHost* host) { |
| 315 RootWindowController* controller = new RootWindowController(host); | 267 RootWindowController* controller = new RootWindowController(host); |
| 316 controller->Init(RootWindowController::PRIMARY, | 268 controller->Init(RootWindowController::PRIMARY, |
| 317 Shell::GetInstance()->delegate()->IsFirstRunAfterBoot()); | 269 Shell::GetInstance()->delegate()->IsFirstRunAfterBoot()); |
| 318 } | 270 } |
| 319 | 271 |
| 320 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) { | 272 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) { |
| 321 RootWindowController* controller = new RootWindowController(host); | 273 RootWindowController* controller = new RootWindowController(host); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 if (animating_wallpaper_controller_.get()) | 341 if (animating_wallpaper_controller_.get()) |
| 390 animating_wallpaper_controller_->StopAnimating(); | 342 animating_wallpaper_controller_->StopAnimating(); |
| 391 animating_wallpaper_controller_.reset(controller); | 343 animating_wallpaper_controller_.reset(controller); |
| 392 } | 344 } |
| 393 | 345 |
| 394 void RootWindowController::Shutdown() { | 346 void RootWindowController::Shutdown() { |
| 395 Shell* shell = Shell::GetInstance(); | 347 Shell* shell = Shell::GetInstance(); |
| 396 shell->RemoveShellObserver(this); | 348 shell->RemoveShellObserver(this); |
| 397 | 349 |
| 398 #if defined(OS_CHROMEOS) | 350 #if defined(OS_CHROMEOS) |
| 399 if (cros_accessibility_observer_) { | 351 if (touch_exploration_manager_) { |
| 400 cros_accessibility_observer_.reset(); | 352 touch_exploration_manager_.reset(); |
| 401 } | 353 } |
| 402 #endif | 354 #endif |
| 403 | 355 |
| 404 if (animating_wallpaper_controller_.get()) | 356 if (animating_wallpaper_controller_.get()) |
| 405 animating_wallpaper_controller_->StopAnimating(); | 357 animating_wallpaper_controller_->StopAnimating(); |
| 406 wallpaper_controller_.reset(); | 358 wallpaper_controller_.reset(); |
| 407 animating_wallpaper_controller_.reset(); | 359 animating_wallpaper_controller_.reset(); |
| 408 aura::Window* root_window = GetRootWindow(); | 360 aura::Window* root_window = GetRootWindow(); |
| 409 // Change the target root window before closing child windows. If any child | 361 // Change the target root window before closing child windows. If any child |
| 410 // being removed triggers a relayout of the shelf it will try to build a | 362 // being removed triggers a relayout of the shelf it will try to build a |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 if (shell->session_state_delegate()->NumberOfLoggedInUsers()) | 752 if (shell->session_state_delegate()->NumberOfLoggedInUsers()) |
| 801 shelf()->CreateShelf(); | 753 shelf()->CreateShelf(); |
| 802 | 754 |
| 803 // Notify shell observers about new root window. | 755 // Notify shell observers about new root window. |
| 804 shell->OnRootWindowAdded(root_window); | 756 shell->OnRootWindowAdded(root_window); |
| 805 } | 757 } |
| 806 | 758 |
| 807 #if defined(OS_CHROMEOS) | 759 #if defined(OS_CHROMEOS) |
| 808 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 760 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 809 switches::kAshDisableTouchExplorationMode)) { | 761 switches::kAshDisableTouchExplorationMode)) { |
| 810 cros_accessibility_observer_.reset(new CrosAccessibilityObserver(this)); | 762 touch_exploration_manager_.reset(new AshTouchExplorationManager(this)); |
| 811 } | 763 } |
| 812 #endif | 764 #endif |
| 813 } | 765 } |
| 814 | 766 |
| 815 void RootWindowController::InitLayoutManagers() { | 767 void RootWindowController::InitLayoutManagers() { |
| 816 aura::Window* root_window = GetRootWindow(); | 768 aura::Window* root_window = GetRootWindow(); |
| 817 root_window_layout_ = new RootWindowLayoutManager(root_window); | 769 root_window_layout_ = new RootWindowLayoutManager(root_window); |
| 818 root_window->SetLayoutManager(root_window_layout_); | 770 root_window->SetLayoutManager(root_window_layout_); |
| 819 | 771 |
| 820 aura::Window* default_container = | 772 aura::Window* default_container = |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 else | 1083 else |
| 1132 DisableTouchHudProjection(); | 1084 DisableTouchHudProjection(); |
| 1133 } | 1085 } |
| 1134 | 1086 |
| 1135 RootWindowController* GetRootWindowController( | 1087 RootWindowController* GetRootWindowController( |
| 1136 const aura::Window* root_window) { | 1088 const aura::Window* root_window) { |
| 1137 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 1089 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |
| 1138 } | 1090 } |
| 1139 | 1091 |
| 1140 } // namespace ash | 1092 } // namespace ash |
| OLD | NEW |