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_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/desktop_background/desktop_background_widget_controller.h" | 10 #include "ash/desktop_background/desktop_background_widget_controller.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "ash/wm/system_modal_container_layout_manager.h" | 31 #include "ash/wm/system_modal_container_layout_manager.h" |
32 #include "ash/wm/toplevel_window_event_handler.h" | 32 #include "ash/wm/toplevel_window_event_handler.h" |
33 #include "ash/wm/visibility_controller.h" | 33 #include "ash/wm/visibility_controller.h" |
34 #include "ash/wm/window_properties.h" | 34 #include "ash/wm/window_properties.h" |
35 #include "ash/wm/workspace_controller.h" | 35 #include "ash/wm/workspace_controller.h" |
36 #include "base/command_line.h" | 36 #include "base/command_line.h" |
37 #include "base/time.h" | 37 #include "base/time.h" |
38 #include "ui/aura/client/activation_client.h" | 38 #include "ui/aura/client/activation_client.h" |
39 #include "ui/aura/client/aura_constants.h" | 39 #include "ui/aura/client/aura_constants.h" |
40 #include "ui/aura/client/capture_client.h" | 40 #include "ui/aura/client/capture_client.h" |
| 41 #include "ui/aura/client/focus_client.h" |
41 #include "ui/aura/client/tooltip_client.h" | 42 #include "ui/aura/client/tooltip_client.h" |
42 #include "ui/aura/focus_manager.h" | |
43 #include "ui/aura/root_window.h" | 43 #include "ui/aura/root_window.h" |
44 #include "ui/aura/window.h" | 44 #include "ui/aura/window.h" |
45 #include "ui/aura/window_observer.h" | 45 #include "ui/aura/window_observer.h" |
46 #include "ui/aura/window_tracker.h" | 46 #include "ui/aura/window_tracker.h" |
47 #include "ui/base/models/menu_model.h" | 47 #include "ui/base/models/menu_model.h" |
48 #include "ui/gfx/display.h" | 48 #include "ui/gfx/display.h" |
49 #include "ui/gfx/screen.h" | 49 #include "ui/gfx/screen.h" |
50 #include "ui/views/controls/menu/menu_model_adapter.h" | 50 #include "ui/views/controls/menu/menu_model_adapter.h" |
51 #include "ui/views/controls/menu/menu_runner.h" | 51 #include "ui/views/controls/menu/menu_runner.h" |
52 #include "ui/views/view_model.h" | 52 #include "ui/views/view_model.h" |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 aura::Window* child = root_window_->children()[0]; | 406 aura::Window* child = root_window_->children()[0]; |
407 delete child; | 407 delete child; |
408 } | 408 } |
409 | 409 |
410 launcher_.reset(); | 410 launcher_.reset(); |
411 // All containers are deleted, so reset shelf_. | 411 // All containers are deleted, so reset shelf_. |
412 shelf_ = NULL; | 412 shelf_ = NULL; |
413 } | 413 } |
414 | 414 |
415 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { | 415 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { |
416 aura::Window* focused = dst->GetFocusManager()->GetFocusedWindow(); | 416 aura::Window* focused = aura::client::GetFocusClient(dst)->GetFocusedWindow(); |
417 aura::WindowTracker tracker; | 417 aura::WindowTracker tracker; |
418 if (focused) | 418 if (focused) |
419 tracker.Add(focused); | 419 tracker.Add(focused); |
420 aura::client::ActivationClient* activation_client = | 420 aura::client::ActivationClient* activation_client = |
421 aura::client::GetActivationClient(dst); | 421 aura::client::GetActivationClient(dst); |
422 aura::Window* active = activation_client->GetActiveWindow(); | 422 aura::Window* active = activation_client->GetActiveWindow(); |
423 if (active && focused != active) | 423 if (active && focused != active) |
424 tracker.Add(active); | 424 tracker.Add(active); |
425 // Deactivate the window to close menu / bubble windows. | 425 // Deactivate the window to close menu / bubble windows. |
426 activation_client->DeactivateWindow(active); | 426 activation_client->DeactivateWindow(active); |
427 // Release capture if any. | 427 // Release capture if any. |
428 aura::client::GetCaptureClient(root_window_.get())-> | 428 aura::client::GetCaptureClient(root_window_.get())-> |
429 SetCapture(NULL); | 429 SetCapture(NULL); |
430 // Clear the focused window if any. This is necessary because a | 430 // Clear the focused window if any. This is necessary because a |
431 // window may be deleted when losing focus (fullscreen flash for | 431 // window may be deleted when losing focus (fullscreen flash for |
432 // example). If the focused window is still alive after move, it'll | 432 // example). If the focused window is still alive after move, it'll |
433 // be re-focused below. | 433 // be re-focused below. |
434 dst->GetFocusManager()->SetFocusedWindow(NULL, NULL); | 434 aura::client::GetFocusClient(dst)->FocusWindow(NULL, NULL); |
435 | 435 |
436 ReparentAllWindows(root_window_.get(), dst); | 436 ReparentAllWindows(root_window_.get(), dst); |
437 | 437 |
438 // Restore focused or active window if it's still alive. | 438 // Restore focused or active window if it's still alive. |
439 if (focused && tracker.Contains(focused) && dst->Contains(focused)) { | 439 if (focused && tracker.Contains(focused) && dst->Contains(focused)) { |
440 dst->GetFocusManager()->SetFocusedWindow(focused, NULL); | 440 aura::client::GetFocusClient(dst)->FocusWindow(focused, NULL); |
441 } else if (active && tracker.Contains(active) && dst->Contains(active)) { | 441 } else if (active && tracker.Contains(active) && dst->Contains(active)) { |
442 activation_client->ActivateWindow(active); | 442 activation_client->ActivateWindow(active); |
443 } | 443 } |
444 } | 444 } |
445 | 445 |
446 void RootWindowController::ShowContextMenu( | 446 void RootWindowController::ShowContextMenu( |
447 const gfx::Point& location_in_screen) { | 447 const gfx::Point& location_in_screen) { |
448 aura::RootWindow* target = Shell::IsLauncherPerDisplayEnabled() ? | 448 aura::RootWindow* target = Shell::IsLauncherPerDisplayEnabled() ? |
449 root_window() : Shell::GetPrimaryRootWindow(); | 449 root_window() : Shell::GetPrimaryRootWindow(); |
450 DCHECK(Shell::GetInstance()->delegate()); | 450 DCHECK(Shell::GetInstance()->delegate()); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 "OverlayContainer", | 647 "OverlayContainer", |
648 lock_screen_related_containers); | 648 lock_screen_related_containers); |
649 SetUsesScreenCoordinates(overlay_container); | 649 SetUsesScreenCoordinates(overlay_container); |
650 | 650 |
651 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, | 651 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, |
652 "PowerButtonAnimationContainer", root_window) ; | 652 "PowerButtonAnimationContainer", root_window) ; |
653 } | 653 } |
654 | 654 |
655 } // namespace internal | 655 } // namespace internal |
656 } // namespace ash | 656 } // namespace ash |
OLD | NEW |