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

Side by Side Diff: trunk/src/ash/root_window_controller.cc

Issue 407073008: Revert 284819 because it introduces leaks in TestingBoundaries and (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/ash_touch_exploration_manager_chromeos.h" 79 #include "ash/system/tray_accessibility.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
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
264 } // namespace 312 } // namespace
265 313
266 void RootWindowController::CreateForPrimaryDisplay(AshWindowTreeHost* host) { 314 void RootWindowController::CreateForPrimaryDisplay(AshWindowTreeHost* host) {
267 RootWindowController* controller = new RootWindowController(host); 315 RootWindowController* controller = new RootWindowController(host);
268 controller->Init(RootWindowController::PRIMARY, 316 controller->Init(RootWindowController::PRIMARY,
269 Shell::GetInstance()->delegate()->IsFirstRunAfterBoot()); 317 Shell::GetInstance()->delegate()->IsFirstRunAfterBoot());
270 } 318 }
271 319
272 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) { 320 void RootWindowController::CreateForSecondaryDisplay(AshWindowTreeHost* host) {
273 RootWindowController* controller = new RootWindowController(host); 321 RootWindowController* controller = new RootWindowController(host);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 if (animating_wallpaper_controller_.get()) 389 if (animating_wallpaper_controller_.get())
342 animating_wallpaper_controller_->StopAnimating(); 390 animating_wallpaper_controller_->StopAnimating();
343 animating_wallpaper_controller_.reset(controller); 391 animating_wallpaper_controller_.reset(controller);
344 } 392 }
345 393
346 void RootWindowController::Shutdown() { 394 void RootWindowController::Shutdown() {
347 Shell* shell = Shell::GetInstance(); 395 Shell* shell = Shell::GetInstance();
348 shell->RemoveShellObserver(this); 396 shell->RemoveShellObserver(this);
349 397
350 #if defined(OS_CHROMEOS) 398 #if defined(OS_CHROMEOS)
351 if (touch_exploration_manager_) { 399 if (cros_accessibility_observer_) {
352 touch_exploration_manager_.reset(); 400 cros_accessibility_observer_.reset();
353 } 401 }
354 #endif 402 #endif
355 403
356 if (animating_wallpaper_controller_.get()) 404 if (animating_wallpaper_controller_.get())
357 animating_wallpaper_controller_->StopAnimating(); 405 animating_wallpaper_controller_->StopAnimating();
358 wallpaper_controller_.reset(); 406 wallpaper_controller_.reset();
359 animating_wallpaper_controller_.reset(); 407 animating_wallpaper_controller_.reset();
360 aura::Window* root_window = GetRootWindow(); 408 aura::Window* root_window = GetRootWindow();
361 // Change the target root window before closing child windows. If any child 409 // Change the target root window before closing child windows. If any child
362 // being removed triggers a relayout of the shelf it will try to build a 410 // 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
752 if (shell->session_state_delegate()->NumberOfLoggedInUsers()) 800 if (shell->session_state_delegate()->NumberOfLoggedInUsers())
753 shelf()->CreateShelf(); 801 shelf()->CreateShelf();
754 802
755 // Notify shell observers about new root window. 803 // Notify shell observers about new root window.
756 shell->OnRootWindowAdded(root_window); 804 shell->OnRootWindowAdded(root_window);
757 } 805 }
758 806
759 #if defined(OS_CHROMEOS) 807 #if defined(OS_CHROMEOS)
760 if (!CommandLine::ForCurrentProcess()->HasSwitch( 808 if (!CommandLine::ForCurrentProcess()->HasSwitch(
761 switches::kAshDisableTouchExplorationMode)) { 809 switches::kAshDisableTouchExplorationMode)) {
762 touch_exploration_manager_.reset(new AshTouchExplorationManager(this)); 810 cros_accessibility_observer_.reset(new CrosAccessibilityObserver(this));
763 } 811 }
764 #endif 812 #endif
765 } 813 }
766 814
767 void RootWindowController::InitLayoutManagers() { 815 void RootWindowController::InitLayoutManagers() {
768 aura::Window* root_window = GetRootWindow(); 816 aura::Window* root_window = GetRootWindow();
769 root_window_layout_ = new RootWindowLayoutManager(root_window); 817 root_window_layout_ = new RootWindowLayoutManager(root_window);
770 root_window->SetLayoutManager(root_window_layout_); 818 root_window->SetLayoutManager(root_window_layout_);
771 819
772 aura::Window* default_container = 820 aura::Window* default_container =
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 else 1131 else
1084 DisableTouchHudProjection(); 1132 DisableTouchHudProjection();
1085 } 1133 }
1086 1134
1087 RootWindowController* GetRootWindowController( 1135 RootWindowController* GetRootWindowController(
1088 const aura::Window* root_window) { 1136 const aura::Window* root_window) {
1089 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; 1137 return root_window ? GetRootWindowSettings(root_window)->controller : NULL;
1090 } 1138 }
1091 1139
1092 } // namespace ash 1140 } // namespace ash
OLDNEW
« no previous file with comments | « trunk/src/ash/root_window_controller.h ('k') | trunk/src/chrome/browser/ui/ash/volume_controller_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698