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

Side by Side Diff: ash/root_window_controller.cc

Issue 261863002: Implementation of the Touch Exploration Mode - Part II (ash) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@touch_exploration_new_UI
Patch Set: Moving CrosAccessibilityObserver to anonymous namespace. Created 6 years, 7 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/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 10 matching lines...) Expand all
21 #include "ash/shelf/shelf_layout_manager.h" 21 #include "ash/shelf/shelf_layout_manager.h"
22 #include "ash/shelf/shelf_types.h" 22 #include "ash/shelf/shelf_types.h"
23 #include "ash/shelf/shelf_widget.h" 23 #include "ash/shelf/shelf_widget.h"
24 #include "ash/shell.h" 24 #include "ash/shell.h"
25 #include "ash/shell_delegate.h" 25 #include "ash/shell_delegate.h"
26 #include "ash/shell_factory.h" 26 #include "ash/shell_factory.h"
27 #include "ash/shell_window_ids.h" 27 #include "ash/shell_window_ids.h"
28 #include "ash/switchable_windows.h" 28 #include "ash/switchable_windows.h"
29 #include "ash/system/status_area_widget.h" 29 #include "ash/system/status_area_widget.h"
30 #include "ash/system/tray/system_tray_delegate.h" 30 #include "ash/system/tray/system_tray_delegate.h"
31 #include "ash/system/tray/system_tray_notifier.h"
31 #include "ash/touch/touch_hud_debug.h" 32 #include "ash/touch/touch_hud_debug.h"
32 #include "ash/touch/touch_hud_projection.h" 33 #include "ash/touch/touch_hud_projection.h"
33 #include "ash/touch/touch_observer_hud.h" 34 #include "ash/touch/touch_observer_hud.h"
34 #include "ash/wm/always_on_top_controller.h" 35 #include "ash/wm/always_on_top_controller.h"
35 #include "ash/wm/dock/docked_window_layout_manager.h" 36 #include "ash/wm/dock/docked_window_layout_manager.h"
36 #include "ash/wm/panels/attached_panel_window_targeter.h" 37 #include "ash/wm/panels/attached_panel_window_targeter.h"
37 #include "ash/wm/panels/panel_layout_manager.h" 38 #include "ash/wm/panels/panel_layout_manager.h"
38 #include "ash/wm/panels/panel_window_event_handler.h" 39 #include "ash/wm/panels/panel_window_event_handler.h"
39 #include "ash/wm/root_window_layout_manager.h" 40 #include "ash/wm/root_window_layout_manager.h"
40 #include "ash/wm/screen_dimmer.h" 41 #include "ash/wm/screen_dimmer.h"
(...skipping 26 matching lines...) Expand all
67 #include "ui/views/view_model_utils.h" 68 #include "ui/views/view_model_utils.h"
68 #include "ui/wm/core/capture_controller.h" 69 #include "ui/wm/core/capture_controller.h"
69 #include "ui/wm/core/easy_resize_window_targeter.h" 70 #include "ui/wm/core/easy_resize_window_targeter.h"
70 #include "ui/wm/core/visibility_controller.h" 71 #include "ui/wm/core/visibility_controller.h"
71 #include "ui/wm/core/window_util.h" 72 #include "ui/wm/core/window_util.h"
72 #include "ui/wm/public/drag_drop_client.h" 73 #include "ui/wm/public/drag_drop_client.h"
73 #include "ui/wm/public/tooltip_client.h" 74 #include "ui/wm/public/tooltip_client.h"
74 #include "ui/wm/public/window_types.h" 75 #include "ui/wm/public/window_types.h"
75 76
76 #if defined(OS_CHROMEOS) 77 #if defined(OS_CHROMEOS)
78 #include "ash/system/tray_accessibility.h"
77 #include "ash/wm/boot_splash_screen_chromeos.h" 79 #include "ash/wm/boot_splash_screen_chromeos.h"
80 #include "ui/chromeos/touch_exploration_controller.h"
78 #endif 81 #endif
79 82
80 namespace ash { 83 namespace ash {
81 namespace { 84 namespace {
82 85
83 #if defined(OS_CHROMEOS) 86 #if defined(OS_CHROMEOS)
84 // Duration for the animation that hides the boot splash screen, in 87 // Duration for the animation that hides the boot splash screen, in
85 // milliseconds. This should be short enough in relation to 88 // milliseconds. This should be short enough in relation to
86 // wm/window_animation.cc's brightness/grayscale fade animation that the login 89 // wm/window_animation.cc's brightness/grayscale fade animation that the login
87 // background image animation isn't hidden by the splash screen animation. 90 // background image animation isn't hidden by the splash screen animation.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 } 253 }
251 virtual bool HasHitTestMask() const OVERRIDE { 254 virtual bool HasHitTestMask() const OVERRIDE {
252 return false; 255 return false;
253 } 256 }
254 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {} 257 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {}
255 258
256 private: 259 private:
257 DISALLOW_COPY_AND_ASSIGN(EmptyWindowDelegate); 260 DISALLOW_COPY_AND_ASSIGN(EmptyWindowDelegate);
258 }; 261 };
259 262
263 #if defined(OS_CHROMEOS)
264 // Responsible for initializing TouchExplorationController when spoken
265 // feedback is on.
266 class CrosAccessibilityObserver : public AccessibilityObserver {
267 public:
268 explicit CrosAccessibilityObserver(
269 RootWindowController* root_window_controller)
270 : root_window_controller_(root_window_controller) {
271 Shell::GetInstance()->system_tray_notifier()->
272 AddAccessibilityObserver(this);
273 UpdateTouchExplorationState();
274 }
275
276 virtual ~CrosAccessibilityObserver() {
277 SystemTrayNotifier* system_tray_notifier =
278 Shell::GetInstance()->system_tray_notifier();
279 if (system_tray_notifier)
280 system_tray_notifier->RemoveAccessibilityObserver(this);
281 }
282
283 private:
284 void UpdateTouchExplorationState() {
285 AccessibilityDelegate* delegate =
286 Shell::GetInstance()->accessibility_delegate();
287 bool enabled = delegate->IsSpokenFeedbackEnabled();
288
289 if (enabled && !touch_exploration_controller_.get()) {
290 touch_exploration_controller_.reset(
291 new ui::TouchExplorationController(
292 root_window_controller_->GetRootWindow()));
293 } else if (!enabled) {
294 touch_exploration_controller_.reset();
295 }
296 }
297
298 // Overridden from AccessibilityObserver.
299 virtual void OnAccessibilityModeChanged(
300 AccessibilityNotificationVisibility notify) OVERRIDE {
301 UpdateTouchExplorationState();
302 }
303
304 scoped_ptr<ui::TouchExplorationController> touch_exploration_controller_;
305 RootWindowController* root_window_controller_;
306
307 DISALLOW_COPY_AND_ASSIGN(CrosAccessibilityObserver);
308 };
309 #endif // OS_CHROMEOS
310
260 } // namespace 311 } // namespace
261 312
262 void RootWindowController::CreateForPrimaryDisplay(AshWindowTreeHost* host) { 313 void RootWindowController::CreateForPrimaryDisplay(AshWindowTreeHost* host) {
263 RootWindowController* controller = new RootWindowController(host); 314 RootWindowController* controller = new RootWindowController(host);
264 controller->Init(RootWindowController::PRIMARY, 315 controller->Init(RootWindowController::PRIMARY,
265 Shell::GetInstance()->delegate()->IsFirstRunAfterBoot()); 316 Shell::GetInstance()->delegate()->IsFirstRunAfterBoot());
266 } 317 }
267 318
268 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) { 319 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) {
269 RootWindowController* controller = new RootWindowController(host); 320 RootWindowController* controller = new RootWindowController(host);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 } 383 }
333 384
334 void RootWindowController::SetAnimatingWallpaperController( 385 void RootWindowController::SetAnimatingWallpaperController(
335 AnimatingDesktopController* controller) { 386 AnimatingDesktopController* controller) {
336 if (animating_wallpaper_controller_.get()) 387 if (animating_wallpaper_controller_.get())
337 animating_wallpaper_controller_->StopAnimating(); 388 animating_wallpaper_controller_->StopAnimating();
338 animating_wallpaper_controller_.reset(controller); 389 animating_wallpaper_controller_.reset(controller);
339 } 390 }
340 391
341 void RootWindowController::Shutdown() { 392 void RootWindowController::Shutdown() {
342 Shell::GetInstance()->RemoveShellObserver(this); 393 Shell* shell = Shell::GetInstance();
394 shell->RemoveShellObserver(this);
395
396 #if defined(OS_CHROMEOS)
397 if (cros_accessibility_observer_) {
398 cros_accessibility_observer_.reset();
399 }
400 #endif
343 401
344 if (animating_wallpaper_controller_.get()) 402 if (animating_wallpaper_controller_.get())
345 animating_wallpaper_controller_->StopAnimating(); 403 animating_wallpaper_controller_->StopAnimating();
346 wallpaper_controller_.reset(); 404 wallpaper_controller_.reset();
347 animating_wallpaper_controller_.reset(); 405 animating_wallpaper_controller_.reset();
348 aura::Window* root_window = GetRootWindow(); 406 aura::Window* root_window = GetRootWindow();
349 // Change the target root window before closing child windows. If any child 407 // Change the target root window before closing child windows. If any child
350 // being removed triggers a relayout of the shelf it will try to build a 408 // being removed triggers a relayout of the shelf it will try to build a
351 // window list adding windows from the target root window's containers which 409 // window list adding windows from the target root window's containers which
352 // may have already gone away. 410 // may have already gone away.
353 if (Shell::GetTargetRootWindow() == root_window) { 411 if (Shell::GetTargetRootWindow() == root_window) {
354 Shell::GetInstance()->set_target_root_window( 412 shell->set_target_root_window(
355 Shell::GetPrimaryRootWindow() == root_window 413 Shell::GetPrimaryRootWindow() == root_window
356 ? NULL 414 ? NULL
357 : Shell::GetPrimaryRootWindow()); 415 : Shell::GetPrimaryRootWindow());
358 } 416 }
359 417
360 CloseChildWindows(); 418 CloseChildWindows();
361 GetRootWindowSettings(root_window)->controller = NULL; 419 GetRootWindowSettings(root_window)->controller = NULL;
362 screen_dimmer_.reset(); 420 screen_dimmer_.reset();
363 workspace_controller_.reset(); 421 workspace_controller_.reset();
364 // Forget with the display ID so that display lookup 422 // Forget with the display ID so that display lookup
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 root_window_layout()->OnWindowResized(); 787 root_window_layout()->OnWindowResized();
730 ash_host_->AsWindowTreeHost()->Show(); 788 ash_host_->AsWindowTreeHost()->Show();
731 789
732 // Create a shelf if a user is already logged in. 790 // Create a shelf if a user is already logged in.
733 if (shell->session_state_delegate()->NumberOfLoggedInUsers()) 791 if (shell->session_state_delegate()->NumberOfLoggedInUsers())
734 shelf()->CreateShelf(); 792 shelf()->CreateShelf();
735 793
736 // Notify shell observers about new root window. 794 // Notify shell observers about new root window.
737 shell->OnRootWindowAdded(root_window); 795 shell->OnRootWindowAdded(root_window);
738 } 796 }
797
798 #if defined(OS_CHROMEOS)
799 if (CommandLine::ForCurrentProcess()->HasSwitch(
800 switches::kAshEnableTouchExplorationMode)) {
801 cros_accessibility_observer_.reset(new CrosAccessibilityObserver(this));
802 }
803 #endif
739 } 804 }
740 805
741 void RootWindowController::InitLayoutManagers() { 806 void RootWindowController::InitLayoutManagers() {
742 aura::Window* root_window = GetRootWindow(); 807 aura::Window* root_window = GetRootWindow();
743 root_window_layout_ = new RootWindowLayoutManager(root_window); 808 root_window_layout_ = new RootWindowLayoutManager(root_window);
744 root_window->SetLayoutManager(root_window_layout_); 809 root_window->SetLayoutManager(root_window_layout_);
745 810
746 aura::Window* default_container = 811 aura::Window* default_container =
747 GetContainer(kShellWindowId_DefaultContainer); 812 GetContainer(kShellWindowId_DefaultContainer);
748 // Workspace manager has its own layout managers. 813 // Workspace manager has its own layout managers.
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 else 1095 else
1031 DisableTouchHudProjection(); 1096 DisableTouchHudProjection();
1032 } 1097 }
1033 1098
1034 RootWindowController* GetRootWindowController( 1099 RootWindowController* GetRootWindowController(
1035 const aura::Window* root_window) { 1100 const aura::Window* root_window) {
1036 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; 1101 return root_window ? GetRootWindowSettings(root_window)->controller : NULL;
1037 } 1102 }
1038 1103
1039 } // namespace ash 1104 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller.h ('k') | chrome/browser/chromeos/accessibility/touch_exploration_controller_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698