| 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 18 matching lines...) Expand all Loading... |
| 29 #include "ash/wm/screen_dimmer.h" | 29 #include "ash/wm/screen_dimmer.h" |
| 30 #include "ash/wm/stacking_controller.h" | 30 #include "ash/wm/stacking_controller.h" |
| 31 #include "ash/wm/status_area_layout_manager.h" | 31 #include "ash/wm/status_area_layout_manager.h" |
| 32 #include "ash/wm/system_background_controller.h" | 32 #include "ash/wm/system_background_controller.h" |
| 33 #include "ash/wm/system_modal_container_layout_manager.h" | 33 #include "ash/wm/system_modal_container_layout_manager.h" |
| 34 #include "ash/wm/toplevel_window_event_handler.h" | 34 #include "ash/wm/toplevel_window_event_handler.h" |
| 35 #include "ash/wm/window_properties.h" | 35 #include "ash/wm/window_properties.h" |
| 36 #include "ash/wm/workspace_controller.h" | 36 #include "ash/wm/workspace_controller.h" |
| 37 #include "base/command_line.h" | 37 #include "base/command_line.h" |
| 38 #include "base/time.h" | 38 #include "base/time.h" |
| 39 #include "ui/aura/client/activation_client.h" | |
| 40 #include "ui/aura/client/aura_constants.h" | 39 #include "ui/aura/client/aura_constants.h" |
| 41 #include "ui/aura/client/capture_client.h" | |
| 42 #include "ui/aura/client/focus_client.h" | |
| 43 #include "ui/aura/client/tooltip_client.h" | 40 #include "ui/aura/client/tooltip_client.h" |
| 44 #include "ui/aura/root_window.h" | 41 #include "ui/aura/root_window.h" |
| 45 #include "ui/aura/window.h" | 42 #include "ui/aura/window.h" |
| 46 #include "ui/aura/window_observer.h" | 43 #include "ui/aura/window_observer.h" |
| 47 #include "ui/aura/window_tracker.h" | |
| 48 #include "ui/base/models/menu_model.h" | 44 #include "ui/base/models/menu_model.h" |
| 49 #include "ui/gfx/display.h" | 45 #include "ui/gfx/display.h" |
| 50 #include "ui/gfx/screen.h" | 46 #include "ui/gfx/screen.h" |
| 51 #include "ui/views/controls/menu/menu_model_adapter.h" | 47 #include "ui/views/controls/menu/menu_model_adapter.h" |
| 52 #include "ui/views/controls/menu/menu_runner.h" | 48 #include "ui/views/controls/menu/menu_runner.h" |
| 53 #include "ui/views/corewm/visibility_controller.h" | 49 #include "ui/views/corewm/visibility_controller.h" |
| 54 #include "ui/views/view_model.h" | 50 #include "ui/views/view_model.h" |
| 55 #include "ui/views/view_model_utils.h" | 51 #include "ui/views/view_model_utils.h" |
| 56 | 52 |
| 57 namespace ash { | 53 namespace ash { |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 | 377 |
| 382 while (!root_window_->children().empty()) { | 378 while (!root_window_->children().empty()) { |
| 383 aura::Window* child = root_window_->children()[0]; | 379 aura::Window* child = root_window_->children()[0]; |
| 384 delete child; | 380 delete child; |
| 385 } | 381 } |
| 386 | 382 |
| 387 shelf_.reset(NULL); | 383 shelf_.reset(NULL); |
| 388 } | 384 } |
| 389 | 385 |
| 390 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { | 386 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { |
| 391 aura::Window* focused = aura::client::GetFocusClient(dst)->GetFocusedWindow(); | |
| 392 aura::WindowTracker tracker; | |
| 393 if (focused) | |
| 394 tracker.Add(focused); | |
| 395 aura::client::ActivationClient* activation_client = | |
| 396 aura::client::GetActivationClient(dst); | |
| 397 aura::Window* active = activation_client->GetActiveWindow(); | |
| 398 if (active && focused != active) | |
| 399 tracker.Add(active); | |
| 400 // Deactivate the window to close menu / bubble windows. | |
| 401 activation_client->DeactivateWindow(active); | |
| 402 // Release capture if any. | |
| 403 aura::client::GetCaptureClient(root_window_.get())-> | |
| 404 SetCapture(NULL); | |
| 405 // Clear the focused window if any. This is necessary because a | |
| 406 // window may be deleted when losing focus (fullscreen flash for | |
| 407 // example). If the focused window is still alive after move, it'll | |
| 408 // be re-focused below. | |
| 409 aura::client::GetFocusClient(dst)->FocusWindow(NULL); | |
| 410 | |
| 411 // Forget the shelf early so that shelf don't update itself using wrong | 387 // Forget the shelf early so that shelf don't update itself using wrong |
| 412 // display info. | 388 // display info. |
| 413 workspace_controller_->SetShelf(NULL); | 389 workspace_controller_->SetShelf(NULL); |
| 414 | |
| 415 ReparentAllWindows(root_window_.get(), dst); | 390 ReparentAllWindows(root_window_.get(), dst); |
| 416 | |
| 417 // Restore focused or active window if it's still alive. | |
| 418 if (focused && tracker.Contains(focused) && dst->Contains(focused)) { | |
| 419 aura::client::GetFocusClient(dst)->FocusWindow(focused); | |
| 420 } else if (active && tracker.Contains(active) && dst->Contains(active)) { | |
| 421 activation_client->ActivateWindow(active); | |
| 422 } | |
| 423 } | 391 } |
| 424 | 392 |
| 425 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { | 393 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { |
| 426 return shelf_.get() ? shelf_->shelf_layout_manager() : NULL; | 394 return shelf_.get() ? shelf_->shelf_layout_manager() : NULL; |
| 427 } | 395 } |
| 428 | 396 |
| 429 SystemTray* RootWindowController::GetSystemTray() { | 397 SystemTray* RootWindowController::GetSystemTray() { |
| 430 // We assume in throughout the code that this will not return NULL. If code | 398 // We assume in throughout the code that this will not return NULL. If code |
| 431 // triggers this for valid reasons, it should test status_area_widget first. | 399 // triggers this for valid reasons, it should test status_area_widget first. |
| 432 CHECK(shelf_.get() && shelf_->status_area_widget()); | 400 CHECK(shelf_.get() && shelf_->status_area_widget()); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 "OverlayContainer", | 598 "OverlayContainer", |
| 631 lock_screen_related_containers); | 599 lock_screen_related_containers); |
| 632 SetUsesScreenCoordinates(overlay_container); | 600 SetUsesScreenCoordinates(overlay_container); |
| 633 | 601 |
| 634 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, | 602 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, |
| 635 "PowerButtonAnimationContainer", root_window) ; | 603 "PowerButtonAnimationContainer", root_window) ; |
| 636 } | 604 } |
| 637 | 605 |
| 638 } // namespace internal | 606 } // namespace internal |
| 639 } // namespace ash | 607 } // namespace ash |
| OLD | NEW |