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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 void WindowServer::OnFirstWindowManagerWindowTreeFactoryReady() { | 241 void WindowServer::OnFirstWindowManagerWindowTreeFactoryReady() { |
242 if (display_manager_->has_active_or_pending_displays()) | 242 if (display_manager_->has_active_or_pending_displays()) |
243 return; | 243 return; |
244 | 244 |
245 // We've been supplied a WindowManagerFactory and no displays have been | 245 // We've been supplied a WindowManagerFactory and no displays have been |
246 // created yet. Treat this as a signal to create a Display. | 246 // created yet. Treat this as a signal to create a Display. |
247 // TODO(sky): we need a better way to determine this, most likely a switch. | 247 // TODO(sky): we need a better way to determine this, most likely a switch. |
248 delegate_->CreateDefaultDisplays(); | 248 delegate_->CreateDefaultDisplays(); |
249 } | 249 } |
250 | 250 |
251 ui::clipboard::ClipboardImpl* WindowServer::GetClipboardForUser( | |
252 const UserId& user_id) { | |
253 DCHECK_GT(clipboard_map_.count(user_id), 0u); | |
254 return clipboard_map_[user_id].get(); | |
255 } | |
256 | |
257 UserActivityMonitor* WindowServer::GetUserActivityMonitorForUser( | 251 UserActivityMonitor* WindowServer::GetUserActivityMonitorForUser( |
258 const UserId& user_id) { | 252 const UserId& user_id) { |
259 DCHECK_GT(activity_monitor_map_.count(user_id), 0u); | 253 DCHECK_GT(activity_monitor_map_.count(user_id), 0u); |
260 return activity_monitor_map_[user_id].get(); | 254 return activity_monitor_map_[user_id].get(); |
261 } | 255 } |
262 | 256 |
263 bool WindowServer::SetFocusedWindow(ServerWindow* window) { | 257 bool WindowServer::SetFocusedWindow(ServerWindow* window) { |
264 // 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| |
265 // is outside that. | 259 // is outside that. |
266 ServerWindow* currently_focused = GetFocusedWindow(); | 260 ServerWindow* currently_focused = GetFocusedWindow(); |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 IsUserInHighContrastMode(active_id)) | 812 IsUserInHighContrastMode(active_id)) |
819 return; | 813 return; |
820 for (Display* display : display_manager_->displays()) { | 814 for (Display* display : display_manager_->displays()) { |
821 display->SchedulePaint(display->root_window(), | 815 display->SchedulePaint(display->root_window(), |
822 gfx::Rect(display->root_window()->bounds().size())); | 816 gfx::Rect(display->root_window()->bounds().size())); |
823 } | 817 } |
824 } | 818 } |
825 | 819 |
826 void WindowServer::OnUserIdAdded(const UserId& id) { | 820 void WindowServer::OnUserIdAdded(const UserId& id) { |
827 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); | 821 activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr); |
828 clipboard_map_[id] = base::MakeUnique<clipboard::ClipboardImpl>(); | |
829 } | 822 } |
830 | 823 |
831 void WindowServer::OnUserIdRemoved(const UserId& id) { | 824 void WindowServer::OnUserIdRemoved(const UserId& id) { |
832 activity_monitor_map_.erase(id); | 825 activity_monitor_map_.erase(id); |
833 clipboard_map_.erase(id); | |
834 } | 826 } |
835 | 827 |
836 } // namespace ws | 828 } // namespace ws |
837 } // namespace ui | 829 } // namespace ui |
OLD | NEW |