| 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 |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 internal::RootWindowController* controller = | 664 internal::RootWindowController* controller = |
| 665 internal::GetRootWindowController(root_to_delete); | 665 internal::GetRootWindowController(root_to_delete); |
| 666 DCHECK(controller); | 666 DCHECK(controller); |
| 667 controller->MoveWindowsTo(GetPrimaryRootWindow()); | 667 controller->MoveWindowsTo(GetPrimaryRootWindow()); |
| 668 // Delete most of root window related objects, but don't delete | 668 // Delete most of root window related objects, but don't delete |
| 669 // root window itself yet because the stack may be using it. | 669 // root window itself yet because the stack may be using it. |
| 670 controller->Shutdown(); | 670 controller->Shutdown(); |
| 671 base::MessageLoop::current()->DeleteSoon(FROM_HERE, controller); | 671 base::MessageLoop::current()->DeleteSoon(FROM_HERE, controller); |
| 672 } | 672 } |
| 673 | 673 |
| 674 void DisplayController::OnWindowTreeHostResized(const aura::RootWindow* root) { | 674 void DisplayController::OnRootWindowHostResized(const aura::RootWindow* root) { |
| 675 internal::DisplayManager* display_manager = GetDisplayManager(); | 675 internal::DisplayManager* display_manager = GetDisplayManager(); |
| 676 gfx::Display display = GetDisplayNearestWindow(root->window()); | 676 gfx::Display display = GetDisplayNearestWindow(root->window()); |
| 677 if (display_manager->UpdateDisplayBounds( | 677 if (display_manager->UpdateDisplayBounds( |
| 678 display.id(), | 678 display.id(), |
| 679 root->host()->GetBounds())) { | 679 root->host()->GetBounds())) { |
| 680 mirror_window_controller_->UpdateWindow(); | 680 mirror_window_controller_->UpdateWindow(); |
| 681 } | 681 } |
| 682 } | 682 } |
| 683 | 683 |
| 684 void DisplayController::CreateOrUpdateNonDesktopDisplay( | 684 void DisplayController::CreateOrUpdateNonDesktopDisplay( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 } | 750 } |
| 751 | 751 |
| 752 aura::RootWindow* DisplayController::AddRootWindowForDisplay( | 752 aura::RootWindow* DisplayController::AddRootWindowForDisplay( |
| 753 const gfx::Display& display) { | 753 const gfx::Display& display) { |
| 754 static int root_window_count = 0; | 754 static int root_window_count = 0; |
| 755 const internal::DisplayInfo& display_info = | 755 const internal::DisplayInfo& display_info = |
| 756 GetDisplayManager()->GetDisplayInfo(display.id()); | 756 GetDisplayManager()->GetDisplayInfo(display.id()); |
| 757 const gfx::Rect& bounds_in_native = display_info.bounds_in_native(); | 757 const gfx::Rect& bounds_in_native = display_info.bounds_in_native(); |
| 758 aura::RootWindow::CreateParams params(bounds_in_native); | 758 aura::RootWindow::CreateParams params(bounds_in_native); |
| 759 params.host = Shell::GetInstance()->root_window_host_factory()-> | 759 params.host = Shell::GetInstance()->root_window_host_factory()-> |
| 760 CreateWindowTreeHost(bounds_in_native); | 760 CreateRootWindowHost(bounds_in_native); |
| 761 aura::RootWindow* root_window = new aura::RootWindow(params); | 761 aura::RootWindow* root_window = new aura::RootWindow(params); |
| 762 root_window->window()->SetName( | 762 root_window->window()->SetName( |
| 763 base::StringPrintf("RootWindow-%d", root_window_count++)); | 763 base::StringPrintf("RootWindow-%d", root_window_count++)); |
| 764 root_window->host()->compositor()->SetBackgroundColor(SK_ColorBLACK); | 764 root_window->host()->compositor()->SetBackgroundColor(SK_ColorBLACK); |
| 765 // No need to remove RootWindowObserver because | 765 // No need to remove RootWindowObserver because |
| 766 // the DisplayController object outlives RootWindow objects. | 766 // the DisplayController object outlives RootWindow objects. |
| 767 root_window->AddRootWindowObserver(this); | 767 root_window->AddRootWindowObserver(this); |
| 768 internal::InitRootWindowSettings(root_window->window())->display_id = | 768 internal::InitRootWindowSettings(root_window->window())->display_id = |
| 769 display.id(); | 769 display.id(); |
| 770 root_window->Init(); | 770 root_window->Init(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 800 std::string name = | 800 std::string name = |
| 801 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; | 801 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; |
| 802 gfx::AcceleratedWidget xwindow = | 802 gfx::AcceleratedWidget xwindow = |
| 803 root_windows[i]->GetDispatcher()->host()->GetAcceleratedWidget(); | 803 root_windows[i]->GetDispatcher()->host()->GetAcceleratedWidget(); |
| 804 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); | 804 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); |
| 805 } | 805 } |
| 806 #endif | 806 #endif |
| 807 } | 807 } |
| 808 | 808 |
| 809 } // namespace ash | 809 } // namespace ash |
| OLD | NEW |