Chromium Code Reviews| 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" |
| 11 #include "ash/ash_switches.h" | 11 #include "ash/ash_switches.h" |
| 12 #include "ash/audio/sounds.h" | |
|
dmazzoni
2014/07/15 18:04:02
No longer needed?
lisayin
2014/07/15 18:47:43
Done.
| |
| 12 #include "ash/desktop_background/desktop_background_controller.h" | 13 #include "ash/desktop_background/desktop_background_controller.h" |
| 13 #include "ash/desktop_background/desktop_background_widget_controller.h" | 14 #include "ash/desktop_background/desktop_background_widget_controller.h" |
| 14 #include "ash/desktop_background/user_wallpaper_delegate.h" | 15 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 15 #include "ash/display/display_manager.h" | 16 #include "ash/display/display_manager.h" |
| 16 #include "ash/focus_cycler.h" | 17 #include "ash/focus_cycler.h" |
| 17 #include "ash/high_contrast/high_contrast_controller.h" | 18 #include "ash/high_contrast/high_contrast_controller.h" |
| 18 #include "ash/host/ash_window_tree_host.h" | 19 #include "ash/host/ash_window_tree_host.h" |
| 19 #include "ash/root_window_settings.h" | 20 #include "ash/root_window_settings.h" |
| 20 #include "ash/session/session_state_delegate.h" | 21 #include "ash/session/session_state_delegate.h" |
| 21 #include "ash/shelf/shelf_layout_manager.h" | 22 #include "ash/shelf/shelf_layout_manager.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 #include "ui/views/view_model_utils.h" | 70 #include "ui/views/view_model_utils.h" |
| 70 #include "ui/wm/core/capture_controller.h" | 71 #include "ui/wm/core/capture_controller.h" |
| 71 #include "ui/wm/core/easy_resize_window_targeter.h" | 72 #include "ui/wm/core/easy_resize_window_targeter.h" |
| 72 #include "ui/wm/core/visibility_controller.h" | 73 #include "ui/wm/core/visibility_controller.h" |
| 73 #include "ui/wm/core/window_util.h" | 74 #include "ui/wm/core/window_util.h" |
| 74 #include "ui/wm/public/drag_drop_client.h" | 75 #include "ui/wm/public/drag_drop_client.h" |
| 75 #include "ui/wm/public/tooltip_client.h" | 76 #include "ui/wm/public/tooltip_client.h" |
| 76 #include "ui/wm/public/window_types.h" | 77 #include "ui/wm/public/window_types.h" |
| 77 | 78 |
| 78 #if defined(OS_CHROMEOS) | 79 #if defined(OS_CHROMEOS) |
| 79 #include "ash/system/tray_accessibility.h" | 80 #include "ash/ash_touch_exploration_manager_chromeos.h" |
| 80 #include "ash/wm/boot_splash_screen_chromeos.h" | 81 #include "ash/wm/boot_splash_screen_chromeos.h" |
| 81 #include "ui/chromeos/touch_exploration_controller.h" | 82 #include "ui/chromeos/touch_exploration_controller.h" |
| 82 #endif | 83 #endif |
| 83 | 84 |
| 84 namespace ash { | 85 namespace ash { |
| 85 namespace { | 86 namespace { |
| 86 | 87 |
| 87 #if defined(OS_CHROMEOS) | 88 #if defined(OS_CHROMEOS) |
| 88 // Duration for the animation that hides the boot splash screen, in | 89 // Duration for the animation that hides the boot splash screen, in |
| 89 // milliseconds. This should be short enough in relation to | 90 // milliseconds. This should be short enough in relation to |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 } | 255 } |
| 255 virtual bool HasHitTestMask() const OVERRIDE { | 256 virtual bool HasHitTestMask() const OVERRIDE { |
| 256 return false; | 257 return false; |
| 257 } | 258 } |
| 258 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {} | 259 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {} |
| 259 | 260 |
| 260 private: | 261 private: |
| 261 DISALLOW_COPY_AND_ASSIGN(EmptyWindowDelegate); | 262 DISALLOW_COPY_AND_ASSIGN(EmptyWindowDelegate); |
| 262 }; | 263 }; |
| 263 | 264 |
| 264 #if defined(OS_CHROMEOS) | |
| 265 // Responsible for initializing TouchExplorationController when spoken | |
| 266 // feedback is on. | |
| 267 class CrosAccessibilityObserver : public AccessibilityObserver { | |
|
James Cook
2014/07/15 18:21:57
Hooray for making root_window_controller.cc shorte
| |
| 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 | 265 } // namespace |
| 313 | 266 |
| 314 void RootWindowController::CreateForPrimaryDisplay(AshWindowTreeHost* host) { | 267 void RootWindowController::CreateForPrimaryDisplay(AshWindowTreeHost* host) { |
| 315 RootWindowController* controller = new RootWindowController(host); | 268 RootWindowController* controller = new RootWindowController(host); |
| 316 controller->Init(RootWindowController::PRIMARY, | 269 controller->Init(RootWindowController::PRIMARY, |
| 317 Shell::GetInstance()->delegate()->IsFirstRunAfterBoot()); | 270 Shell::GetInstance()->delegate()->IsFirstRunAfterBoot()); |
| 318 } | 271 } |
| 319 | 272 |
| 320 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) { | 273 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) { |
| 321 RootWindowController* controller = new RootWindowController(host); | 274 RootWindowController* controller = new RootWindowController(host); |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 801 if (shell->session_state_delegate()->NumberOfLoggedInUsers()) | 754 if (shell->session_state_delegate()->NumberOfLoggedInUsers()) |
| 802 shelf()->CreateShelf(); | 755 shelf()->CreateShelf(); |
| 803 | 756 |
| 804 // Notify shell observers about new root window. | 757 // Notify shell observers about new root window. |
| 805 shell->OnRootWindowAdded(root_window); | 758 shell->OnRootWindowAdded(root_window); |
| 806 } | 759 } |
| 807 | 760 |
| 808 #if defined(OS_CHROMEOS) | 761 #if defined(OS_CHROMEOS) |
| 809 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 762 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 810 switches::kAshDisableTouchExplorationMode)) { | 763 switches::kAshDisableTouchExplorationMode)) { |
| 811 cros_accessibility_observer_.reset(new CrosAccessibilityObserver(this)); | 764 cros_accessibility_observer_.reset(new CrosAccessibilityObserver(this)); |
|
dmazzoni
2014/07/15 18:04:01
Rename this to match the new name of the class.
lisayin
2014/07/15 21:46:44
Done.
| |
| 812 } | 765 } |
| 813 #endif | 766 #endif |
| 814 } | 767 } |
| 815 | 768 |
| 816 void RootWindowController::InitLayoutManagers() { | 769 void RootWindowController::InitLayoutManagers() { |
| 817 aura::Window* root_window = GetRootWindow(); | 770 aura::Window* root_window = GetRootWindow(); |
| 818 root_window_layout_ = new RootWindowLayoutManager(root_window); | 771 root_window_layout_ = new RootWindowLayoutManager(root_window); |
| 819 root_window->SetLayoutManager(root_window_layout_); | 772 root_window->SetLayoutManager(root_window_layout_); |
| 820 | 773 |
| 821 aura::Window* default_container = | 774 aura::Window* default_container = |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1111 else | 1064 else |
| 1112 DisableTouchHudProjection(); | 1065 DisableTouchHudProjection(); |
| 1113 } | 1066 } |
| 1114 | 1067 |
| 1115 RootWindowController* GetRootWindowController( | 1068 RootWindowController* GetRootWindowController( |
| 1116 const aura::Window* root_window) { | 1069 const aura::Window* root_window) { |
| 1117 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 1070 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |
| 1118 } | 1071 } |
| 1119 | 1072 |
| 1120 } // namespace ash | 1073 } // namespace ash |
| OLD | NEW |