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

Side by Side Diff: ash/display/display_manager.cc

Issue 2282903003: Remove MouseWarpController construction from ash::DisplayManager (Closed)
Patch Set: rebased Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « ash/display/display_manager.h ('k') | ash/display/display_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/display/display_manager.h" 5 #include "ash/display/display_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 #include <utility> 13 #include <utility>
14 #include <vector> 14 #include <vector>
15 15
16 #include "ash/common/ash_switches.h" 16 #include "ash/common/ash_switches.h"
17 #include "ash/display/display_util.h" 17 #include "ash/display/display_util.h"
18 #include "ash/display/extended_mouse_warp_controller.h"
19 #include "ash/display/null_mouse_warp_controller.h"
20 #include "ash/display/screen_ash.h" 18 #include "ash/display/screen_ash.h"
21 #include "ash/display/unified_mouse_warp_controller.h"
22 #include "ash/screen_util.h" 19 #include "ash/screen_util.h"
23 #include "ash/shell.h" 20 #include "ash/shell.h"
24 #include "base/auto_reset.h" 21 #include "base/auto_reset.h"
25 #include "base/command_line.h" 22 #include "base/command_line.h"
26 #include "base/logging.h" 23 #include "base/logging.h"
27 #include "base/memory/ptr_util.h" 24 #include "base/memory/ptr_util.h"
28 #include "base/metrics/histogram.h" 25 #include "base/metrics/histogram.h"
29 #include "base/run_loop.h" 26 #include "base/run_loop.h"
30 #include "base/strings/string_number_conversions.h" 27 #include "base/strings/string_number_conversions.h"
31 #include "base/strings/string_split.h" 28 #include "base/strings/string_split.h"
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 // Do not post a task if the software mirroring doesn't exist, or 1061 // Do not post a task if the software mirroring doesn't exist, or
1065 // during initialization when compositor's init task isn't posted yet. 1062 // during initialization when compositor's init task isn't posted yet.
1066 // ash::Shell::Init() will call this after the compositor is initialized. 1063 // ash::Shell::Init() will call this after the compositor is initialized.
1067 if (software_mirroring_display_list_.empty() || !delegate_) 1064 if (software_mirroring_display_list_.empty() || !delegate_)
1068 return; 1065 return;
1069 base::ThreadTaskRunnerHandle::Get()->PostTask( 1066 base::ThreadTaskRunnerHandle::Get()->PostTask(
1070 FROM_HERE, base::Bind(&DisplayManager::CreateMirrorWindowIfAny, 1067 FROM_HERE, base::Bind(&DisplayManager::CreateMirrorWindowIfAny,
1071 weak_ptr_factory_.GetWeakPtr())); 1068 weak_ptr_factory_.GetWeakPtr()));
1072 } 1069 }
1073 1070
1074 std::unique_ptr<MouseWarpController> DisplayManager::CreateMouseWarpController(
1075 aura::Window* drag_source) const {
1076 if (IsInUnifiedMode() && num_connected_displays() >= 2)
1077 return base::MakeUnique<UnifiedMouseWarpController>();
1078 // Extra check for |num_connected_displays()| is for SystemDisplayApiTest
1079 // that injects MockScreen.
1080 if (GetNumDisplays() < 2 || num_connected_displays() < 2)
1081 return base::MakeUnique<NullMouseWarpController>();
1082 return base::MakeUnique<ExtendedMouseWarpController>(drag_source);
1083 }
1084
1085 void DisplayManager::CreateScreenForShutdown() const { 1071 void DisplayManager::CreateScreenForShutdown() const {
1086 delete screen_for_shutdown; 1072 delete screen_for_shutdown;
1087 screen_for_shutdown = screen_->CloneForShutdown(); 1073 screen_for_shutdown = screen_->CloneForShutdown();
1088 display::Screen::SetScreenInstance(screen_for_shutdown); 1074 display::Screen::SetScreenInstance(screen_for_shutdown);
1089 } 1075 }
1090 1076
1091 void DisplayManager::UpdateInternalManagedDisplayModeListForTest() { 1077 void DisplayManager::UpdateInternalManagedDisplayModeListForTest() {
1092 if (!display::Display::HasInternalDisplay() || 1078 if (!display::Display::HasInternalDisplay() ||
1093 display_info_.count(display::Display::InternalDisplayId()) == 0) 1079 display_info_.count(display::Display::InternalDisplayId()) == 0)
1094 return; 1080 return;
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 layout.ApplyToDisplayList(display_list, updated_ids, 1393 layout.ApplyToDisplayList(display_list, updated_ids,
1408 kMinimumOverlapForInvalidOffset); 1394 kMinimumOverlapForInvalidOffset);
1409 } 1395 }
1410 1396
1411 void DisplayManager::RunPendingTasksForTest() { 1397 void DisplayManager::RunPendingTasksForTest() {
1412 if (!software_mirroring_display_list_.empty()) 1398 if (!software_mirroring_display_list_.empty())
1413 base::RunLoop().RunUntilIdle(); 1399 base::RunLoop().RunUntilIdle();
1414 } 1400 }
1415 1401
1416 } // namespace ash 1402 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager.h ('k') | ash/display/display_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698