| 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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 internal::RootWindowController* controller = | 680 internal::RootWindowController* controller = |
| 681 internal::GetRootWindowController(root_to_delete); | 681 internal::GetRootWindowController(root_to_delete); |
| 682 DCHECK(controller); | 682 DCHECK(controller); |
| 683 controller->MoveWindowsTo(GetPrimaryRootWindow()); | 683 controller->MoveWindowsTo(GetPrimaryRootWindow()); |
| 684 // Delete most of root window related objects, but don't delete | 684 // Delete most of root window related objects, but don't delete |
| 685 // root window itself yet because the stack may be using it. | 685 // root window itself yet because the stack may be using it. |
| 686 controller->Shutdown(); | 686 controller->Shutdown(); |
| 687 base::MessageLoop::current()->DeleteSoon(FROM_HERE, controller); | 687 base::MessageLoop::current()->DeleteSoon(FROM_HERE, controller); |
| 688 } | 688 } |
| 689 | 689 |
| 690 void DisplayController::OnRootWindowHostResized(const aura::RootWindow* root) { | 690 void DisplayController::OnWindowTreeHostResized(const aura::RootWindow* root) { |
| 691 internal::DisplayManager* display_manager = GetDisplayManager(); | 691 internal::DisplayManager* display_manager = GetDisplayManager(); |
| 692 gfx::Display display = GetDisplayNearestWindow(root->window()); | 692 gfx::Display display = GetDisplayNearestWindow(root->window()); |
| 693 if (display_manager->UpdateDisplayBounds( | 693 if (display_manager->UpdateDisplayBounds( |
| 694 display.id(), | 694 display.id(), |
| 695 root->host()->GetBounds())) { | 695 root->host()->GetBounds())) { |
| 696 mirror_window_controller_->UpdateWindow(); | 696 mirror_window_controller_->UpdateWindow(); |
| 697 } | 697 } |
| 698 } | 698 } |
| 699 | 699 |
| 700 void DisplayController::CreateOrUpdateNonDesktopDisplay( | 700 void DisplayController::CreateOrUpdateNonDesktopDisplay( |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 } | 765 } |
| 766 | 766 |
| 767 aura::RootWindow* DisplayController::AddRootWindowForDisplay( | 767 aura::RootWindow* DisplayController::AddRootWindowForDisplay( |
| 768 const gfx::Display& display) { | 768 const gfx::Display& display) { |
| 769 static int root_window_count = 0; | 769 static int root_window_count = 0; |
| 770 const internal::DisplayInfo& display_info = | 770 const internal::DisplayInfo& display_info = |
| 771 GetDisplayManager()->GetDisplayInfo(display.id()); | 771 GetDisplayManager()->GetDisplayInfo(display.id()); |
| 772 const gfx::Rect& bounds_in_native = display_info.bounds_in_native(); | 772 const gfx::Rect& bounds_in_native = display_info.bounds_in_native(); |
| 773 aura::RootWindow::CreateParams params(bounds_in_native); | 773 aura::RootWindow::CreateParams params(bounds_in_native); |
| 774 params.host = Shell::GetInstance()->root_window_host_factory()-> | 774 params.host = Shell::GetInstance()->root_window_host_factory()-> |
| 775 CreateRootWindowHost(bounds_in_native); | 775 CreateWindowTreeHost(bounds_in_native); |
| 776 aura::RootWindow* root_window = new aura::RootWindow(params); | 776 aura::RootWindow* root_window = new aura::RootWindow(params); |
| 777 root_window->window()->SetName( | 777 root_window->window()->SetName( |
| 778 base::StringPrintf("RootWindow-%d", root_window_count++)); | 778 base::StringPrintf("RootWindow-%d", root_window_count++)); |
| 779 root_window->host()->compositor()->SetBackgroundColor(SK_ColorBLACK); | 779 root_window->host()->compositor()->SetBackgroundColor(SK_ColorBLACK); |
| 780 // No need to remove RootWindowObserver because | 780 // No need to remove RootWindowObserver because |
| 781 // the DisplayController object outlives RootWindow objects. | 781 // the DisplayController object outlives RootWindow objects. |
| 782 root_window->AddRootWindowObserver(this); | 782 root_window->AddRootWindowObserver(this); |
| 783 internal::InitRootWindowSettings(root_window->window())->display_id = | 783 internal::InitRootWindowSettings(root_window->window())->display_id = |
| 784 display.id(); | 784 display.id(); |
| 785 root_window->Init(); | 785 root_window->Init(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 815 std::string name = | 815 std::string name = |
| 816 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; | 816 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; |
| 817 gfx::AcceleratedWidget xwindow = | 817 gfx::AcceleratedWidget xwindow = |
| 818 root_windows[i]->GetDispatcher()->host()->GetAcceleratedWidget(); | 818 root_windows[i]->GetDispatcher()->host()->GetAcceleratedWidget(); |
| 819 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); | 819 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); |
| 820 } | 820 } |
| 821 #endif | 821 #endif |
| 822 } | 822 } |
| 823 | 823 |
| 824 } // namespace ash | 824 } // namespace ash |
| OLD | NEW |