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

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

Issue 2257763002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
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>
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 if (software_mirroring_display_list_.empty() || !delegate_) 1050 if (software_mirroring_display_list_.empty() || !delegate_)
1051 return; 1051 return;
1052 base::ThreadTaskRunnerHandle::Get()->PostTask( 1052 base::ThreadTaskRunnerHandle::Get()->PostTask(
1053 FROM_HERE, base::Bind(&DisplayManager::CreateMirrorWindowIfAny, 1053 FROM_HERE, base::Bind(&DisplayManager::CreateMirrorWindowIfAny,
1054 weak_ptr_factory_.GetWeakPtr())); 1054 weak_ptr_factory_.GetWeakPtr()));
1055 } 1055 }
1056 1056
1057 std::unique_ptr<MouseWarpController> DisplayManager::CreateMouseWarpController( 1057 std::unique_ptr<MouseWarpController> DisplayManager::CreateMouseWarpController(
1058 aura::Window* drag_source) const { 1058 aura::Window* drag_source) const {
1059 if (IsInUnifiedMode() && num_connected_displays() >= 2) 1059 if (IsInUnifiedMode() && num_connected_displays() >= 2)
1060 return base::WrapUnique(new UnifiedMouseWarpController()); 1060 return base::MakeUnique<UnifiedMouseWarpController>();
1061 // Extra check for |num_connected_displays()| is for SystemDisplayApiTest 1061 // Extra check for |num_connected_displays()| is for SystemDisplayApiTest
1062 // that injects MockScreen. 1062 // that injects MockScreen.
1063 if (GetNumDisplays() < 2 || num_connected_displays() < 2) 1063 if (GetNumDisplays() < 2 || num_connected_displays() < 2)
1064 return base::WrapUnique(new NullMouseWarpController()); 1064 return base::MakeUnique<NullMouseWarpController>();
1065 return base::WrapUnique(new ExtendedMouseWarpController(drag_source)); 1065 return base::MakeUnique<ExtendedMouseWarpController>(drag_source);
1066 } 1066 }
1067 1067
1068 void DisplayManager::CreateScreenForShutdown() const { 1068 void DisplayManager::CreateScreenForShutdown() const {
1069 delete screen_for_shutdown; 1069 delete screen_for_shutdown;
1070 screen_for_shutdown = screen_->CloneForShutdown(); 1070 screen_for_shutdown = screen_->CloneForShutdown();
1071 display::Screen::SetScreenInstance(screen_for_shutdown); 1071 display::Screen::SetScreenInstance(screen_for_shutdown);
1072 } 1072 }
1073 1073
1074 void DisplayManager::UpdateInternalDisplayModeListForTest() { 1074 void DisplayManager::UpdateInternalDisplayModeListForTest() {
1075 if (!display::Display::HasInternalDisplay() || 1075 if (!display::Display::HasInternalDisplay() ||
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 layout.ApplyToDisplayList(display_list, updated_ids, 1349 layout.ApplyToDisplayList(display_list, updated_ids,
1350 kMinimumOverlapForInvalidOffset); 1350 kMinimumOverlapForInvalidOffset);
1351 } 1351 }
1352 1352
1353 void DisplayManager::RunPendingTasksForTest() { 1353 void DisplayManager::RunPendingTasksForTest() {
1354 if (!software_mirroring_display_list_.empty()) 1354 if (!software_mirroring_display_list_.empty())
1355 base::RunLoop().RunUntilIdle(); 1355 base::RunLoop().RunUntilIdle();
1356 } 1356 }
1357 1357
1358 } // namespace ash 1358 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_change_observer_chromeos_unittest.cc ('k') | ash/display/extended_mouse_warp_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698