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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "ash/wm/screen_dimmer.h" | 31 #include "ash/wm/screen_dimmer.h" |
32 #include "ash/wm/stacking_controller.h" | 32 #include "ash/wm/stacking_controller.h" |
33 #include "ash/wm/status_area_layout_manager.h" | 33 #include "ash/wm/status_area_layout_manager.h" |
34 #include "ash/wm/system_background_controller.h" | 34 #include "ash/wm/system_background_controller.h" |
35 #include "ash/wm/system_modal_container_layout_manager.h" | 35 #include "ash/wm/system_modal_container_layout_manager.h" |
36 #include "ash/wm/toplevel_window_event_handler.h" | 36 #include "ash/wm/toplevel_window_event_handler.h" |
37 #include "ash/wm/window_properties.h" | 37 #include "ash/wm/window_properties.h" |
38 #include "ash/wm/workspace_controller.h" | 38 #include "ash/wm/workspace_controller.h" |
39 #include "base/command_line.h" | 39 #include "base/command_line.h" |
40 #include "base/time.h" | 40 #include "base/time.h" |
41 #include "ui/aura/client/activation_client.h" | |
42 #include "ui/aura/client/aura_constants.h" | 41 #include "ui/aura/client/aura_constants.h" |
43 #include "ui/aura/client/capture_client.h" | |
44 #include "ui/aura/client/focus_client.h" | |
45 #include "ui/aura/client/tooltip_client.h" | 42 #include "ui/aura/client/tooltip_client.h" |
46 #include "ui/aura/root_window.h" | 43 #include "ui/aura/root_window.h" |
47 #include "ui/aura/window.h" | 44 #include "ui/aura/window.h" |
48 #include "ui/aura/window_observer.h" | 45 #include "ui/aura/window_observer.h" |
49 #include "ui/aura/window_tracker.h" | |
50 #include "ui/base/models/menu_model.h" | 46 #include "ui/base/models/menu_model.h" |
51 #include "ui/gfx/display.h" | 47 #include "ui/gfx/display.h" |
52 #include "ui/gfx/screen.h" | 48 #include "ui/gfx/screen.h" |
53 #include "ui/keyboard/keyboard_controller.h" | 49 #include "ui/keyboard/keyboard_controller.h" |
54 #include "ui/keyboard/keyboard_util.h" | 50 #include "ui/keyboard/keyboard_util.h" |
55 #include "ui/views/controls/menu/menu_runner.h" | 51 #include "ui/views/controls/menu/menu_runner.h" |
56 #include "ui/views/corewm/visibility_controller.h" | 52 #include "ui/views/corewm/visibility_controller.h" |
57 #include "ui/views/view_model.h" | 53 #include "ui/views/view_model.h" |
58 #include "ui/views/view_model_utils.h" | 54 #include "ui/views/view_model_utils.h" |
59 | 55 |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 395 |
400 while (!root_window_->children().empty()) { | 396 while (!root_window_->children().empty()) { |
401 aura::Window* child = root_window_->children()[0]; | 397 aura::Window* child = root_window_->children()[0]; |
402 delete child; | 398 delete child; |
403 } | 399 } |
404 | 400 |
405 shelf_.reset(NULL); | 401 shelf_.reset(NULL); |
406 } | 402 } |
407 | 403 |
408 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { | 404 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { |
409 aura::Window* focused = aura::client::GetFocusClient(dst)->GetFocusedWindow(); | |
410 aura::WindowTracker tracker; | |
411 if (focused) | |
412 tracker.Add(focused); | |
413 aura::client::ActivationClient* activation_client = | |
414 aura::client::GetActivationClient(dst); | |
415 aura::Window* active = activation_client->GetActiveWindow(); | |
416 if (active && focused != active) | |
417 tracker.Add(active); | |
418 // Deactivate the window to close menu / bubble windows. | |
419 activation_client->DeactivateWindow(active); | |
420 // Release capture if any. | |
421 aura::client::GetCaptureClient(root_window_.get())-> | |
422 SetCapture(NULL); | |
423 // Clear the focused window if any. This is necessary because a | |
424 // window may be deleted when losing focus (fullscreen flash for | |
425 // example). If the focused window is still alive after move, it'll | |
426 // be re-focused below. | |
427 aura::client::GetFocusClient(dst)->FocusWindow(NULL); | |
428 | |
429 // Forget the shelf early so that shelf don't update itself using wrong | 405 // Forget the shelf early so that shelf don't update itself using wrong |
430 // display info. | 406 // display info. |
431 workspace_controller_->SetShelf(NULL); | 407 workspace_controller_->SetShelf(NULL); |
432 | |
433 ReparentAllWindows(root_window_.get(), dst); | 408 ReparentAllWindows(root_window_.get(), dst); |
434 | |
435 // Restore focused or active window if it's still alive. | |
436 if (focused && tracker.Contains(focused) && dst->Contains(focused)) { | |
437 aura::client::GetFocusClient(dst)->FocusWindow(focused); | |
438 } else if (active && tracker.Contains(active) && dst->Contains(active)) { | |
439 activation_client->ActivateWindow(active); | |
440 } | |
441 } | 409 } |
442 | 410 |
443 void RootWindowController::SetTouchObserverHUD(TouchObserverHUD* hud) { | 411 void RootWindowController::SetTouchObserverHUD(TouchObserverHUD* hud) { |
444 if (touch_observer_hud_) | 412 if (touch_observer_hud_) |
445 root_window_->RemovePreTargetHandler(touch_observer_hud_.get()); | 413 root_window_->RemovePreTargetHandler(touch_observer_hud_.get()); |
446 if (hud) | 414 if (hud) |
447 root_window_->AddPreTargetHandler(hud); | 415 root_window_->AddPreTargetHandler(hud); |
448 touch_observer_hud_.reset(hud); | 416 touch_observer_hud_.reset(hud); |
449 } | 417 } |
450 | 418 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 "OverlayContainer", | 639 "OverlayContainer", |
672 lock_screen_related_containers); | 640 lock_screen_related_containers); |
673 SetUsesScreenCoordinates(overlay_container); | 641 SetUsesScreenCoordinates(overlay_container); |
674 | 642 |
675 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, | 643 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, |
676 "PowerButtonAnimationContainer", root_window) ; | 644 "PowerButtonAnimationContainer", root_window) ; |
677 } | 645 } |
678 | 646 |
679 } // namespace internal | 647 } // namespace internal |
680 } // namespace ash | 648 } // namespace ash |
OLD | NEW |