Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Unified Diff: ash/display/display_util.cc

Issue 2282903003: Remove MouseWarpController construction from ash::DisplayManager (Closed)
Patch Set: rebased Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/display/display_util.h ('k') | ash/display/mouse_cursor_event_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_util.cc
diff --git a/ash/display/display_util.cc b/ash/display/display_util.cc
index e5b254462901ba068486041978059c5d8d070f2a..6b12107cc341b67ac0355f96735691ba6a97d72e 100644
--- a/ash/display/display_util.cc
+++ b/ash/display/display_util.cc
@@ -10,6 +10,11 @@
#include "ash/common/system/system_notifier.h"
#include "ash/common/wm_shell.h"
#include "ash/display/display_manager.h"
+
+#include "ash/display/extended_mouse_warp_controller.h"
+#include "ash/display/null_mouse_warp_controller.h"
+#include "ash/display/unified_mouse_warp_controller.h"
+
#include "ash/host/ash_window_tree_host.h"
#include "ash/shell.h"
#include "base/strings/string_number_conversions.h"
@@ -83,6 +88,18 @@ scoped_refptr<display::ManagedDisplayMode> GetDisplayModeForUIScale(
} // namespace
+std::unique_ptr<MouseWarpController> CreateMouseWarpController(
+ DisplayManager* manager,
+ aura::Window* drag_source) {
+ if (manager->IsInUnifiedMode() && manager->num_connected_displays() >= 2)
+ return base::MakeUnique<UnifiedMouseWarpController>();
+ // Extra check for |num_connected_displays()| is for SystemDisplayApiTest
+ // that injects MockScreen.
+ if (manager->GetNumDisplays() < 2 || manager->num_connected_displays() < 2)
+ return base::MakeUnique<NullMouseWarpController>();
+ return base::MakeUnique<ExtendedMouseWarpController>(drag_source);
+}
+
bool SetDisplayUIScale(int64_t id, float ui_scale) {
DisplayManager* display_manager = Shell::GetInstance()->display_manager();
if (!display_manager->IsActiveDisplayId(id) ||
« no previous file with comments | « ash/display/display_util.h ('k') | ash/display/mouse_cursor_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698