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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 void WindowServer::OnFirstWindowManagerWindowTreeFactoryReady() { | 235 void WindowServer::OnFirstWindowManagerWindowTreeFactoryReady() { |
236 if (display_manager_->has_active_or_pending_displays()) | 236 if (display_manager_->has_active_or_pending_displays()) |
237 return; | 237 return; |
238 | 238 |
239 // We've been supplied a WindowManagerFactory and no displays have been | 239 // We've been supplied a WindowManagerFactory and no displays have been |
240 // created yet. Treat this as a signal to create a Display. | 240 // created yet. Treat this as a signal to create a Display. |
241 // TODO(sky): we need a better way to determine this, most likely a switch. | 241 // TODO(sky): we need a better way to determine this, most likely a switch. |
242 delegate_->CreateDefaultDisplays(); | 242 delegate_->CreateDefaultDisplays(); |
243 } | 243 } |
244 | 244 |
| 245 ui::clipboard::ClipboardImpl* WindowServer::GetClipboardForUser( |
| 246 const UserId& user_id) { |
| 247 DCHECK_GT(clipboard_map_.count(user_id), 0u); |
| 248 return clipboard_map_[user_id].get(); |
| 249 } |
| 250 |
245 UserActivityMonitor* WindowServer::GetUserActivityMonitorForUser( | 251 UserActivityMonitor* WindowServer::GetUserActivityMonitorForUser( |
246 const UserId& user_id) { | 252 const UserId& user_id) { |
247 DCHECK_GT(activity_monitor_map_.count(user_id), 0u); | 253 DCHECK_GT(activity_monitor_map_.count(user_id), 0u); |
248 return activity_monitor_map_[user_id].get(); | 254 return activity_monitor_map_[user_id].get(); |
249 } | 255 } |
250 | 256 |
251 bool WindowServer::SetFocusedWindow(ServerWindow* window) { | 257 bool WindowServer::SetFocusedWindow(ServerWindow* window) { |
252 // TODO(sky): this should fail if there is modal dialog active and |window| | 258 // TODO(sky): this should fail if there is modal dialog active and |window| |
253 // is outside that. | 259 // is outside that. |
254 ServerWindow* currently_focused = GetFocusedWindow(); | 260 ServerWindow* currently_focused = GetFocusedWindow(); |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 IsUserInHighContrastMode(active_id)) | 768 IsUserInHighContrastMode(active_id)) |
763 return; | 769 return; |
764 for (Display* display : display_manager_->displays()) { | 770 for (Display* display : display_manager_->displays()) { |
765 display->SchedulePaint(display->root_window(), | 771 display->SchedulePaint(display->root_window(), |
766 gfx::Rect(display->root_window()->bounds().size())); | 772 gfx::Rect(display->root_window()->bounds().size())); |
767 } | 773 } |
768 } | 774 } |
769 | 775 |
770 void WindowServer::OnUserIdAdded(const UserId& id) { | 776 void WindowServer::OnUserIdAdded(const UserId& id) { |
771 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); | 777 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); |
| 778 clipboard_map_[id] = base::MakeUnique<clipboard::ClipboardImpl>(); |
772 } | 779 } |
773 | 780 |
774 void WindowServer::OnUserIdRemoved(const UserId& id) { | 781 void WindowServer::OnUserIdRemoved(const UserId& id) { |
775 activity_monitor_map_.erase(id); | 782 activity_monitor_map_.erase(id); |
| 783 clipboard_map_.erase(id); |
776 } | 784 } |
777 | 785 |
778 } // namespace ws | 786 } // namespace ws |
779 } // namespace ui | 787 } // namespace ui |
OLD | NEW |