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

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: Fixing indent. 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
260 } // namespace 263 } // namespace
261 264
265 #if defined(OS_CHROMEOS)
266 // Responsible for initializing TouchExplorationController when spoken
267 // feedback is on.
268 class CrosAccessibilityObserver : public AccessibilityObserver {
oshima 2014/05/02 20:04:24 please move this to anonymous namespace above
mfomitchev 2014/05/02 20:46:33 It's used in .h file and I get a 'fatal' warning i
oshima 2014/05/02 21:25:46 Can you use AccessibilityObserver in the header in
269 public:
270 explicit CrosAccessibilityObserver(
271 RootWindowController* root_window_controller)
272 : root_window_controller_(root_window_controller) {
273 Shell::GetInstance()->system_tray_notifier()->
274 AddAccessibilityObserver(this);
275 UpdateTouchExplorationState();
276 }
277
278 virtual ~CrosAccessibilityObserver() {
279 SystemTrayNotifier* system_tray_notifier =
280 Shell::GetInstance()->system_tray_notifier();
281 if (system_tray_notifier)
282 system_tray_notifier->RemoveAccessibilityObserver(this);
283 touch_exploration_controller_.reset();
oshima 2014/05/02 20:04:24 you don't need this.
mfomitchev 2014/05/02 21:01:00 Done.
284 }
285
286 private:
287 void UpdateTouchExplorationState() {
288 AccessibilityDelegate* delegate =
289 Shell::GetInstance()->accessibility_delegate();
290 bool enabled = delegate->IsSpokenFeedbackEnabled();
291
292 if (enabled && !touch_exploration_controller_.get()) {
293 touch_exploration_controller_.reset(
294 new ui::TouchExplorationController(
295 root_window_controller_->GetRootWindow()));
296 } else if (!enabled && touch_exploration_controller_.get()) {
oshima 2014/05/02 20:04:24 you can skip checking _.get() and always reset().
mfomitchev 2014/05/02 21:01:00 Done.
297 touch_exploration_controller_.reset();
298 }
299 }
300
301 // Overridden from AccessibilityObserver.
302 virtual void OnAccessibilityModeChanged(
303 AccessibilityNotificationVisibility notify) OVERRIDE {
304 UpdateTouchExplorationState();
305 }
306
307 scoped_ptr<ui::TouchExplorationController> touch_exploration_controller_;
308 RootWindowController* root_window_controller_;
309
310 DISALLOW_COPY_AND_ASSIGN(CrosAccessibilityObserver);
311 };
312 #endif // OS_CHROMEOS
313
262 void RootWindowController::CreateForPrimaryDisplay(AshWindowTreeHost* host) { 314 void RootWindowController::CreateForPrimaryDisplay(AshWindowTreeHost* host) {
263 RootWindowController* controller = new RootWindowController(host); 315 RootWindowController* controller = new RootWindowController(host);
264 controller->Init(RootWindowController::PRIMARY, 316 controller->Init(RootWindowController::PRIMARY,
265 Shell::GetInstance()->delegate()->IsFirstRunAfterBoot()); 317 Shell::GetInstance()->delegate()->IsFirstRunAfterBoot());
266 } 318 }
267 319
268 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) { 320 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) {
269 RootWindowController* controller = new RootWindowController(host); 321 RootWindowController* controller = new RootWindowController(host);
270 controller->Init(RootWindowController::SECONDARY, false /* first run */); 322 controller->Init(RootWindowController::SECONDARY, false /* first run */);
271 } 323 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 } 384 }
333 385
334 void RootWindowController::SetAnimatingWallpaperController( 386 void RootWindowController::SetAnimatingWallpaperController(
335 AnimatingDesktopController* controller) { 387 AnimatingDesktopController* controller) {
336 if (animating_wallpaper_controller_.get()) 388 if (animating_wallpaper_controller_.get())
337 animating_wallpaper_controller_->StopAnimating(); 389 animating_wallpaper_controller_->StopAnimating();
338 animating_wallpaper_controller_.reset(controller); 390 animating_wallpaper_controller_.reset(controller);
339 } 391 }
340 392
341 void RootWindowController::Shutdown() { 393 void RootWindowController::Shutdown() {
342 Shell::GetInstance()->RemoveShellObserver(this); 394 Shell* shell = Shell::GetInstance();
395 shell->RemoveShellObserver(this);
396
397 #if defined(OS_CHROMEOS)
398 if (cros_accessibility_observer_) {
399 cros_accessibility_observer_.reset();
400 }
401 #endif
343 402
344 if (animating_wallpaper_controller_.get()) 403 if (animating_wallpaper_controller_.get())
345 animating_wallpaper_controller_->StopAnimating(); 404 animating_wallpaper_controller_->StopAnimating();
346 wallpaper_controller_.reset(); 405 wallpaper_controller_.reset();
347 animating_wallpaper_controller_.reset(); 406 animating_wallpaper_controller_.reset();
348 aura::Window* root_window = GetRootWindow(); 407 aura::Window* root_window = GetRootWindow();
349 // Change the target root window before closing child windows. If any child 408 // 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 409 // 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 410 // window list adding windows from the target root window's containers which
352 // may have already gone away. 411 // may have already gone away.
353 if (Shell::GetTargetRootWindow() == root_window) { 412 if (Shell::GetTargetRootWindow() == root_window) {
354 Shell::GetInstance()->set_target_root_window( 413 shell->set_target_root_window(
355 Shell::GetPrimaryRootWindow() == root_window 414 Shell::GetPrimaryRootWindow() == root_window
356 ? NULL 415 ? NULL
357 : Shell::GetPrimaryRootWindow()); 416 : Shell::GetPrimaryRootWindow());
358 } 417 }
359 418
360 CloseChildWindows(); 419 CloseChildWindows();
361 GetRootWindowSettings(root_window)->controller = NULL; 420 GetRootWindowSettings(root_window)->controller = NULL;
362 screen_dimmer_.reset(); 421 screen_dimmer_.reset();
363 workspace_controller_.reset(); 422 workspace_controller_.reset();
364 // Forget with the display ID so that display lookup 423 // 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(); 788 root_window_layout()->OnWindowResized();
730 ash_host_->AsWindowTreeHost()->Show(); 789 ash_host_->AsWindowTreeHost()->Show();
731 790
732 // Create a shelf if a user is already logged in. 791 // Create a shelf if a user is already logged in.
733 if (shell->session_state_delegate()->NumberOfLoggedInUsers()) 792 if (shell->session_state_delegate()->NumberOfLoggedInUsers())
734 shelf()->CreateShelf(); 793 shelf()->CreateShelf();
735 794
736 // Notify shell observers about new root window. 795 // Notify shell observers about new root window.
737 shell->OnRootWindowAdded(root_window); 796 shell->OnRootWindowAdded(root_window);
738 } 797 }
798
799 #if defined(OS_CHROMEOS)
800 if (CommandLine::ForCurrentProcess()->HasSwitch(
801 switches::kAshEnableTouchExplorationMode)) {
802 cros_accessibility_observer_.reset(new CrosAccessibilityObserver(this));
803 }
804 #endif
739 } 805 }
740 806
741 void RootWindowController::InitLayoutManagers() { 807 void RootWindowController::InitLayoutManagers() {
742 aura::Window* root_window = GetRootWindow(); 808 aura::Window* root_window = GetRootWindow();
743 root_window_layout_ = new RootWindowLayoutManager(root_window); 809 root_window_layout_ = new RootWindowLayoutManager(root_window);
744 root_window->SetLayoutManager(root_window_layout_); 810 root_window->SetLayoutManager(root_window_layout_);
745 811
746 aura::Window* default_container = 812 aura::Window* default_container =
747 GetContainer(kShellWindowId_DefaultContainer); 813 GetContainer(kShellWindowId_DefaultContainer);
748 // Workspace manager has its own layout managers. 814 // Workspace manager has its own layout managers.
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 else 1096 else
1031 DisableTouchHudProjection(); 1097 DisableTouchHudProjection();
1032 } 1098 }
1033 1099
1034 RootWindowController* GetRootWindowController( 1100 RootWindowController* GetRootWindowController(
1035 const aura::Window* root_window) { 1101 const aura::Window* root_window) {
1036 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; 1102 return root_window ? GetRootWindowSettings(root_window)->controller : NULL;
1037 } 1103 }
1038 1104
1039 } // namespace ash 1105 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698