| 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" |
| 39 #include "ui/aura/client/aura_constants.h" | 40 #include "ui/aura/client/aura_constants.h" |
| 41 #include "ui/aura/client/capture_client.h" |
| 42 #include "ui/aura/client/focus_client.h" |
| 40 #include "ui/aura/client/tooltip_client.h" | 43 #include "ui/aura/client/tooltip_client.h" |
| 41 #include "ui/aura/root_window.h" | 44 #include "ui/aura/root_window.h" |
| 42 #include "ui/aura/window.h" | 45 #include "ui/aura/window.h" |
| 43 #include "ui/aura/window_observer.h" | 46 #include "ui/aura/window_observer.h" |
| 47 #include "ui/aura/window_tracker.h" |
| 44 #include "ui/base/models/menu_model.h" | 48 #include "ui/base/models/menu_model.h" |
| 45 #include "ui/gfx/display.h" | 49 #include "ui/gfx/display.h" |
| 46 #include "ui/gfx/screen.h" | 50 #include "ui/gfx/screen.h" |
| 47 #include "ui/views/controls/menu/menu_model_adapter.h" | 51 #include "ui/views/controls/menu/menu_model_adapter.h" |
| 48 #include "ui/views/controls/menu/menu_runner.h" | 52 #include "ui/views/controls/menu/menu_runner.h" |
| 49 #include "ui/views/corewm/visibility_controller.h" | 53 #include "ui/views/corewm/visibility_controller.h" |
| 50 #include "ui/views/view_model.h" | 54 #include "ui/views/view_model.h" |
| 51 #include "ui/views/view_model_utils.h" | 55 #include "ui/views/view_model_utils.h" |
| 52 | 56 |
| 53 namespace ash { | 57 namespace ash { |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 | 381 |
| 378 while (!root_window_->children().empty()) { | 382 while (!root_window_->children().empty()) { |
| 379 aura::Window* child = root_window_->children()[0]; | 383 aura::Window* child = root_window_->children()[0]; |
| 380 delete child; | 384 delete child; |
| 381 } | 385 } |
| 382 | 386 |
| 383 shelf_.reset(NULL); | 387 shelf_.reset(NULL); |
| 384 } | 388 } |
| 385 | 389 |
| 386 void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { | 390 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 |
| 387 // Forget the shelf early so that shelf don't update itself using wrong | 411 // Forget the shelf early so that shelf don't update itself using wrong |
| 388 // display info. | 412 // display info. |
| 389 workspace_controller_->SetShelf(NULL); | 413 workspace_controller_->SetShelf(NULL); |
| 414 |
| 390 ReparentAllWindows(root_window_.get(), dst); | 415 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 } |
| 391 } | 423 } |
| 392 | 424 |
| 393 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { | 425 ShelfLayoutManager* RootWindowController::GetShelfLayoutManager() { |
| 394 return shelf_.get() ? shelf_->shelf_layout_manager() : NULL; | 426 return shelf_.get() ? shelf_->shelf_layout_manager() : NULL; |
| 395 } | 427 } |
| 396 | 428 |
| 397 SystemTray* RootWindowController::GetSystemTray() { | 429 SystemTray* RootWindowController::GetSystemTray() { |
| 398 // We assume in throughout the code that this will not return NULL. If code | 430 // We assume in throughout the code that this will not return NULL. If code |
| 399 // triggers this for valid reasons, it should test status_area_widget first. | 431 // triggers this for valid reasons, it should test status_area_widget first. |
| 400 CHECK(shelf_.get() && shelf_->status_area_widget()); | 432 CHECK(shelf_.get() && shelf_->status_area_widget()); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 "OverlayContainer", | 630 "OverlayContainer", |
| 599 lock_screen_related_containers); | 631 lock_screen_related_containers); |
| 600 SetUsesScreenCoordinates(overlay_container); | 632 SetUsesScreenCoordinates(overlay_container); |
| 601 | 633 |
| 602 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, | 634 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, |
| 603 "PowerButtonAnimationContainer", root_window) ; | 635 "PowerButtonAnimationContainer", root_window) ; |
| 604 } | 636 } |
| 605 | 637 |
| 606 } // namespace internal | 638 } // namespace internal |
| 607 } // namespace ash | 639 } // namespace ash |
| OLD | NEW |