| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "services/ui/ws/window_server.h" | 5 #include "services/ui/ws/window_server.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 WindowServer::WindowServer(WindowServerDelegate* delegate) | 40 WindowServer::WindowServer(WindowServerDelegate* delegate) |
| 41 : delegate_(delegate), | 41 : delegate_(delegate), |
| 42 surfaces_state_(new SurfacesState()), | 42 surfaces_state_(new SurfacesState()), |
| 43 next_client_id_(1), | 43 next_client_id_(1), |
| 44 display_manager_(new DisplayManager(this, &user_id_tracker_)), | 44 display_manager_(new DisplayManager(this, &user_id_tracker_)), |
| 45 current_operation_(nullptr), | 45 current_operation_(nullptr), |
| 46 in_destructor_(false), | 46 in_destructor_(false), |
| 47 next_wm_change_id_(0), | 47 next_wm_change_id_(0), |
| 48 gpu_proxy_(new GpuServiceProxy(this)), |
| 48 window_manager_window_tree_factory_set_(this, &user_id_tracker_) { | 49 window_manager_window_tree_factory_set_(this, &user_id_tracker_) { |
| 49 user_id_tracker_.AddObserver(this); | 50 user_id_tracker_.AddObserver(this); |
| 50 OnUserIdAdded(user_id_tracker_.active_id()); | 51 OnUserIdAdded(user_id_tracker_.active_id()); |
| 51 } | 52 } |
| 52 | 53 |
| 53 WindowServer::~WindowServer() { | 54 WindowServer::~WindowServer() { |
| 54 in_destructor_ = true; | 55 in_destructor_ = true; |
| 55 | 56 |
| 56 // Destroys the window trees results in querying for the display. Tear down | 57 // Destroys the window trees results in querying for the display. Tear down |
| 57 // the displays first so that the trees are notified of the display going | 58 // the displays first so that the trees are notified of the display going |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 ServerWindow* transient_child) { | 758 ServerWindow* transient_child) { |
| 758 // If we're deleting a window, then this is a superfluous message. | 759 // If we're deleting a window, then this is a superfluous message. |
| 759 if (current_operation_type() == OperationType::DELETE_WINDOW) | 760 if (current_operation_type() == OperationType::DELETE_WINDOW) |
| 760 return; | 761 return; |
| 761 for (auto& pair : tree_map_) { | 762 for (auto& pair : tree_map_) { |
| 762 pair.second->ProcessTransientWindowRemoved(window, transient_child, | 763 pair.second->ProcessTransientWindowRemoved(window, transient_child, |
| 763 IsOperationSource(pair.first)); | 764 IsOperationSource(pair.first)); |
| 764 } | 765 } |
| 765 } | 766 } |
| 766 | 767 |
| 768 void WindowServer::OnGpuChannelEstablished( |
| 769 scoped_refptr<gpu::GpuChannelHost> gpu_channel) { |
| 770 const std::set<Display*>& displays = display_manager()->displays(); |
| 771 for (auto* display : displays) |
| 772 display->platform_display()->OnGpuChannelEstablished(gpu_channel); |
| 773 } |
| 774 |
| 767 void WindowServer::OnActiveUserIdChanged(const UserId& previously_active_id, | 775 void WindowServer::OnActiveUserIdChanged(const UserId& previously_active_id, |
| 768 const UserId& active_id) { | 776 const UserId& active_id) { |
| 769 if (IsUserInHighContrastMode(previously_active_id) == | 777 if (IsUserInHighContrastMode(previously_active_id) == |
| 770 IsUserInHighContrastMode(active_id)) | 778 IsUserInHighContrastMode(active_id)) |
| 771 return; | 779 return; |
| 772 for (Display* display : display_manager_->displays()) { | 780 for (Display* display : display_manager_->displays()) { |
| 773 display->SchedulePaint(display->root_window(), | 781 display->SchedulePaint(display->root_window(), |
| 774 gfx::Rect(display->root_window()->bounds().size())); | 782 gfx::Rect(display->root_window()->bounds().size())); |
| 775 } | 783 } |
| 776 } | 784 } |
| 777 | 785 |
| 778 void WindowServer::OnUserIdAdded(const UserId& id) { | 786 void WindowServer::OnUserIdAdded(const UserId& id) { |
| 779 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); | 787 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); |
| 780 clipboard_map_[id] = base::MakeUnique<clipboard::ClipboardImpl>(); | 788 clipboard_map_[id] = base::MakeUnique<clipboard::ClipboardImpl>(); |
| 781 } | 789 } |
| 782 | 790 |
| 783 void WindowServer::OnUserIdRemoved(const UserId& id) { | 791 void WindowServer::OnUserIdRemoved(const UserId& id) { |
| 784 activity_monitor_map_.erase(id); | 792 activity_monitor_map_.erase(id); |
| 785 clipboard_map_.erase(id); | 793 clipboard_map_.erase(id); |
| 786 } | 794 } |
| 787 | 795 |
| 788 } // namespace ws | 796 } // namespace ws |
| 789 } // namespace ui | 797 } // namespace ui |
| OLD | NEW |