Index: services/ui/ws/display_manager.cc |
diff --git a/services/ui/ws/display_manager.cc b/services/ui/ws/display_manager.cc |
index 993375261062d9d1b55ea34a286e516931fb7798..70b3b58fec5e6884927d07160546737de4ba5808 100644 |
--- a/services/ui/ws/display_manager.cc |
+++ b/services/ui/ws/display_manager.cc |
@@ -5,23 +5,27 @@ |
#include "services/ui/ws/display_manager.h" |
#include "base/memory/ptr_util.h" |
+#include "services/ui/display/platform_screen.h" |
#include "services/ui/ws/display.h" |
-#include "services/ui/ws/display_manager_delegate.h" |
+#include "services/ui/ws/display_binding.h" |
#include "services/ui/ws/event_dispatcher.h" |
+#include "services/ui/ws/platform_display_init_params.h" |
#include "services/ui/ws/server_window.h" |
#include "services/ui/ws/user_display_manager.h" |
+#include "services/ui/ws/user_display_manager_delegate.h" |
#include "services/ui/ws/user_id_tracker.h" |
#include "services/ui/ws/window_manager_state.h" |
+#include "services/ui/ws/window_server_delegate.h" |
namespace ui { |
namespace ws { |
-DisplayManager::DisplayManager(DisplayManagerDelegate* delegate, |
+DisplayManager::DisplayManager(WindowServer* window_server, |
UserIdTracker* user_id_tracker) |
// |next_root_id_| is used as the lower bits, so that starting at 0 is |
// fine. |next_display_id_| is used by itself, so we start at 1 to reserve |
// 0 as invalid. |
- : delegate_(delegate), |
+ : window_server_(window_server), |
user_id_tracker_(user_id_tracker), |
next_root_id_(0) { |
user_id_tracker_->AddObserver(this); |
@@ -36,7 +40,7 @@ UserDisplayManager* DisplayManager::GetUserDisplayManager( |
const UserId& user_id) { |
if (!user_display_managers_.count(user_id)) { |
user_display_managers_[user_id] = |
- base::MakeUnique<UserDisplayManager>(this, delegate_, user_id); |
+ base::MakeUnique<UserDisplayManager>(this, window_server_, user_id); |
} |
return user_display_managers_[user_id].get(); |
} |
@@ -61,7 +65,7 @@ void DisplayManager::DestroyDisplay(Display* display) { |
// If we have no more roots left, let the app know so it can terminate. |
// TODO(sky): move to delegate/observer. |
if (displays_.empty() && pending_displays_.empty()) |
- delegate_->OnNoMoreDisplays(); |
+ window_server_->OnNoMoreDisplays(); |
} |
void DisplayManager::DestroyAllDisplays() { |
@@ -135,13 +139,13 @@ void DisplayManager::OnDisplayAcceleratedWidgetAvailable(Display* display) { |
displays_.insert(display); |
pending_displays_.erase(display); |
if (is_first_display) |
- delegate_->OnFirstDisplayReady(); |
+ window_server_->OnFirstDisplayReady(); |
} |
void DisplayManager::OnActiveUserIdChanged(const UserId& previously_active_id, |
const UserId& active_id) { |
WindowManagerState* previous_window_manager_state = |
- delegate_->GetWindowManagerStateForUser(previously_active_id); |
+ window_server_->GetWindowManagerStateForUser(previously_active_id); |
gfx::Point mouse_location_on_screen; |
if (previous_window_manager_state) { |
mouse_location_on_screen = previous_window_manager_state->event_dispatcher() |
@@ -150,10 +154,35 @@ void DisplayManager::OnActiveUserIdChanged(const UserId& previously_active_id, |
} |
WindowManagerState* current_window_manager_state = |
- delegate_->GetWindowManagerStateForUser(active_id); |
+ window_server_->GetWindowManagerStateForUser(active_id); |
if (current_window_manager_state) |
current_window_manager_state->Activate(mouse_location_on_screen); |
} |
+void DisplayManager::OnDisplayAdded(display::PlatformScreen* platform_screen, |
+ int64_t id, |
+ const gfx::Rect& bounds) { |
+ PlatformDisplayInitParams params; |
+ params.display_bounds = bounds; |
+ params.display_id = id; |
+ params.platform_screen = platform_screen; |
+ params.surfaces_state = window_server_->GetSurfacesState(); |
+ |
+ ws::Display* display = new ws::Display(window_server_, params); |
+ display->Init(nullptr); |
+ |
+ window_server_->delegate()->UpdateTouchTransforms(); |
+} |
+ |
+void DisplayManager::OnDisplayRemoved(int64_t id) { |
+ // TODO(kylechar): Implement. |
+ NOTREACHED(); |
+} |
+ |
+void DisplayManager::OnDisplayModified(int64_t id, const gfx::Rect& bounds) { |
+ // TODO(kylechar): Implement. |
+ NOTREACHED(); |
+} |
+ |
} // namespace ws |
} // namespace ui |