| 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/display/display_controller.h" | 5 #include "ash/display/display_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| 11 #include "ash/ash_switches.h" | 11 #include "ash/ash_switches.h" |
| 12 #include "ash/display/cursor_window_controller.h" | 12 #include "ash/display/cursor_window_controller.h" |
| 13 #include "ash/display/display_layout_store.h" | 13 #include "ash/display/display_layout_store.h" |
| 14 #include "ash/display/display_manager.h" | 14 #include "ash/display/display_manager.h" |
| 15 #include "ash/display/mirror_window_controller.h" | 15 #include "ash/display/mirror_window_controller.h" |
| 16 #include "ash/display/root_window_transformers.h" | 16 #include "ash/display/root_window_transformers.h" |
| 17 #include "ash/host/ash_window_tree_host.h" | 17 #include "ash/host/ash_window_tree_host.h" |
| 18 #include "ash/host/ash_window_tree_host_init_params.h" | 18 #include "ash/host/ash_window_tree_host_init_params.h" |
| 19 #include "ash/host/root_window_transformer.h" | 19 #include "ash/host/root_window_transformer.h" |
| 20 #include "ash/magnifier/magnification_controller.h" |
| 21 #include "ash/magnifier/partial_magnification_controller.h" |
| 20 #include "ash/root_window_controller.h" | 22 #include "ash/root_window_controller.h" |
| 21 #include "ash/root_window_settings.h" | 23 #include "ash/root_window_settings.h" |
| 22 #include "ash/screen_util.h" | 24 #include "ash/screen_util.h" |
| 23 #include "ash/shell.h" | 25 #include "ash/shell.h" |
| 24 #include "ash/shell_delegate.h" | 26 #include "ash/shell_delegate.h" |
| 25 #include "ash/wm/coordinate_conversion.h" | 27 #include "ash/wm/coordinate_conversion.h" |
| 26 #include "base/command_line.h" | 28 #include "base/command_line.h" |
| 27 #include "base/stl_util.h" | 29 #include "base/stl_util.h" |
| 28 #include "base/strings/stringprintf.h" | 30 #include "base/strings/stringprintf.h" |
| 29 #include "base/strings/utf_string_conversions.h" | 31 #include "base/strings/utf_string_conversions.h" |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 } | 362 } |
| 361 | 363 |
| 362 aura::Window* DisplayController::GetRootWindowForDisplayId(int64 id) { | 364 aura::Window* DisplayController::GetRootWindowForDisplayId(int64 id) { |
| 363 AshWindowTreeHost* host = GetAshWindowTreeHostForDisplayId(id); | 365 AshWindowTreeHost* host = GetAshWindowTreeHostForDisplayId(id); |
| 364 CHECK(host); | 366 CHECK(host); |
| 365 return GetWindow(host); | 367 return GetWindow(host); |
| 366 } | 368 } |
| 367 | 369 |
| 368 AshWindowTreeHost* DisplayController::GetAshWindowTreeHostForDisplayId( | 370 AshWindowTreeHost* DisplayController::GetAshWindowTreeHostForDisplayId( |
| 369 int64 id) { | 371 int64 id) { |
| 370 CHECK_EQ(1u, window_tree_hosts_.count(id)); | 372 CHECK_EQ(1u, window_tree_hosts_.count(id)) << "id = " << id; |
| 371 return window_tree_hosts_[id]; | 373 return window_tree_hosts_[id]; |
| 372 } | 374 } |
| 373 | 375 |
| 374 void DisplayController::CloseChildWindows() { | 376 void DisplayController::CloseChildWindows() { |
| 375 for (WindowTreeHostMap::const_iterator it = window_tree_hosts_.begin(); | 377 for (WindowTreeHostMap::const_iterator it = window_tree_hosts_.begin(); |
| 376 it != window_tree_hosts_.end(); | 378 it != window_tree_hosts_.end(); |
| 377 ++it) { | 379 ++it) { |
| 378 aura::Window* root_window = GetWindow(it->second); | 380 aura::Window* root_window = GetWindow(it->second); |
| 379 RootWindowController* controller = GetRootWindowController(root_window); | 381 RootWindowController* controller = GetRootWindowController(root_window); |
| 380 if (controller) { | 382 if (controller) { |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 void DisplayController::OnDisplayAdded(const gfx::Display& display) { | 635 void DisplayController::OnDisplayAdded(const gfx::Display& display) { |
| 634 #if defined(OS_CHROMEOS) | 636 #if defined(OS_CHROMEOS) |
| 635 if (GetDisplayManager()->default_multi_display_mode() == | 637 if (GetDisplayManager()->default_multi_display_mode() == |
| 636 DisplayManager::UNIFIED) { | 638 DisplayManager::UNIFIED) { |
| 637 if (primary_display_id == gfx::Display::kInvalidDisplayID) | 639 if (primary_display_id == gfx::Display::kInvalidDisplayID) |
| 638 primary_display_id = display.id(); | 640 primary_display_id = display.id(); |
| 639 AshWindowTreeHost* ash_host = | 641 AshWindowTreeHost* ash_host = |
| 640 AddWindowTreeHostForDisplay(display, AshWindowTreeHostInitParams()); | 642 AddWindowTreeHostForDisplay(display, AshWindowTreeHostInitParams()); |
| 641 RootWindowController::CreateForSecondaryDisplay(ash_host); | 643 RootWindowController::CreateForSecondaryDisplay(ash_host); |
| 642 | 644 |
| 645 // Magnifier controllers keep pointers to the current root window. |
| 646 // Update them here to avoid accessing them later. |
| 647 Shell::GetInstance()->magnification_controller()->SwitchTargetRootWindow( |
| 648 ash_host->AsWindowTreeHost()->window(), false); |
| 649 Shell::GetInstance() |
| 650 ->partial_magnification_controller() |
| 651 ->SwitchTargetRootWindow(ash_host->AsWindowTreeHost()->window()); |
| 652 |
| 643 if (primary_tree_host_for_replace_) { | 653 if (primary_tree_host_for_replace_) { |
| 644 AshWindowTreeHost* to_delete = primary_tree_host_for_replace_; | 654 AshWindowTreeHost* to_delete = primary_tree_host_for_replace_; |
| 645 primary_tree_host_for_replace_ = nullptr; | 655 primary_tree_host_for_replace_ = nullptr; |
| 646 DeleteHost(to_delete); | 656 DeleteHost(to_delete); |
| 647 #ifndef NDEBUG | 657 #ifndef NDEBUG |
| 648 auto iter = std::find_if( | 658 auto iter = std::find_if( |
| 649 window_tree_hosts_.begin(), window_tree_hosts_.end(), | 659 window_tree_hosts_.begin(), window_tree_hosts_.end(), |
| 650 [to_delete](const std::pair<int64, AshWindowTreeHost*>& pair) { | 660 [to_delete](const std::pair<int64, AshWindowTreeHost*>& pair) { |
| 651 return pair.second == to_delete; | 661 return pair.second == to_delete; |
| 652 }); | 662 }); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 Shell::GetInstance()->display_configurator_animation() | 883 Shell::GetInstance()->display_configurator_animation() |
| 874 ->StartFadeInAnimation(); | 884 ->StartFadeInAnimation(); |
| 875 #endif | 885 #endif |
| 876 } | 886 } |
| 877 | 887 |
| 878 void DisplayController::SetMirrorModeAfterAnimation(bool mirror) { | 888 void DisplayController::SetMirrorModeAfterAnimation(bool mirror) { |
| 879 GetDisplayManager()->SetMirrorMode(mirror); | 889 GetDisplayManager()->SetMirrorMode(mirror); |
| 880 } | 890 } |
| 881 | 891 |
| 882 } // namespace ash | 892 } // namespace ash |
| OLD | NEW |