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

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

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 8 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/window_tree_host_manager.h" 5 #include "ash/display/window_tree_host_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <map> 9 #include <map>
10 #include <memory>
10 #include <utility> 11 #include <utility>
11 12
12 #include "ash/ash_switches.h" 13 #include "ash/ash_switches.h"
13 #include "ash/display/cursor_window_controller.h" 14 #include "ash/display/cursor_window_controller.h"
14 #include "ash/display/display_layout_store.h" 15 #include "ash/display/display_layout_store.h"
15 #include "ash/display/display_manager.h" 16 #include "ash/display/display_manager.h"
16 #include "ash/display/mirror_window_controller.h" 17 #include "ash/display/mirror_window_controller.h"
17 #include "ash/display/root_window_transformers.h" 18 #include "ash/display/root_window_transformers.h"
18 #include "ash/host/ash_window_tree_host.h" 19 #include "ash/host/ash_window_tree_host.h"
19 #include "ash/host/ash_window_tree_host_init_params.h" 20 #include "ash/host/ash_window_tree_host_init_params.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Scale all motion on High-DPI displays. 127 // Scale all motion on High-DPI displays.
127 float scale = display.device_scale_factor(); 128 float scale = display.device_scale_factor();
128 129
129 if (!display.IsInternal()) 130 if (!display.IsInternal())
130 scale *= kCursorMultiplierForExternalDisplays; 131 scale *= kCursorMultiplierForExternalDisplays;
131 132
132 ui::CursorController::GetInstance()->SetCursorConfigForWindow( 133 ui::CursorController::GetInstance()->SetCursorConfigForWindow(
133 host->GetAcceleratedWidget(), info.GetActiveRotation(), scale); 134 host->GetAcceleratedWidget(), info.GetActiveRotation(), scale);
134 #endif 135 #endif
135 #endif 136 #endif
136 scoped_ptr<RootWindowTransformer> transformer( 137 std::unique_ptr<RootWindowTransformer> transformer(
137 CreateRootWindowTransformerForDisplay(host->window(), display)); 138 CreateRootWindowTransformerForDisplay(host->window(), display));
138 ash_host->SetRootWindowTransformer(std::move(transformer)); 139 ash_host->SetRootWindowTransformer(std::move(transformer));
139 140
140 DisplayMode mode = 141 DisplayMode mode =
141 GetDisplayManager()->GetActiveModeForDisplayId(display.id()); 142 GetDisplayManager()->GetActiveModeForDisplayId(display.id());
142 if (mode.refresh_rate > 0.0f) { 143 if (mode.refresh_rate > 0.0f) {
143 host->compositor()->SetAuthoritativeVSyncInterval( 144 host->compositor()->SetAuthoritativeVSyncInterval(
144 base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond / 145 base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond /
145 mode.refresh_rate)); 146 mode.refresh_rate));
146 } 147 }
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 window_tree_hosts_[old_primary_display.id()] = non_primary_host; 440 window_tree_hosts_[old_primary_display.id()] = non_primary_host;
440 GetRootWindowSettings(GetWindow(non_primary_host))->display_id = 441 GetRootWindowSettings(GetWindow(non_primary_host))->display_id =
441 old_primary_display.id(); 442 old_primary_display.id();
442 443
443 const display::DisplayLayout& layout = 444 const display::DisplayLayout& layout =
444 GetDisplayManager()->GetCurrentDisplayLayout(); 445 GetDisplayManager()->GetCurrentDisplayLayout();
445 // The requested primary id can be same as one in the stored layout 446 // The requested primary id can be same as one in the stored layout
446 // when the primary id is set after new displays are connected. 447 // when the primary id is set after new displays are connected.
447 // Only update the layout if it is requested to swap primary display. 448 // Only update the layout if it is requested to swap primary display.
448 if (layout.primary_id != new_primary_display.id()) { 449 if (layout.primary_id != new_primary_display.id()) {
449 scoped_ptr<display::DisplayLayout> swapped_layout(layout.Copy()); 450 std::unique_ptr<display::DisplayLayout> swapped_layout(layout.Copy());
450 swapped_layout->placement_list[0].Swap(); 451 swapped_layout->placement_list[0].Swap();
451 swapped_layout->primary_id = new_primary_display.id(); 452 swapped_layout->primary_id = new_primary_display.id();
452 display::DisplayIdList list = display_manager->GetCurrentDisplayIdList(); 453 display::DisplayIdList list = display_manager->GetCurrentDisplayIdList();
453 GetDisplayManager()->layout_store()->RegisterLayoutForDisplayIdList( 454 GetDisplayManager()->layout_store()->RegisterLayoutForDisplayIdList(
454 list, std::move(swapped_layout)); 455 list, std::move(swapped_layout));
455 } 456 }
456 457
457 primary_display_id = new_primary_display.id(); 458 primary_display_id = new_primary_display.id();
458 459
459 UpdateWorkAreaOfDisplayNearestWindow(GetWindow(primary_host), 460 UpdateWorkAreaOfDisplayNearestWindow(GetWindow(primary_host),
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 SetDisplayPropertiesOnHost(ash_host, display); 842 SetDisplayPropertiesOnHost(ash_host, display);
842 843
843 #if defined(OS_CHROMEOS) 844 #if defined(OS_CHROMEOS)
844 if (switches::ConstrainPointerToRoot()) 845 if (switches::ConstrainPointerToRoot())
845 ash_host->ConfineCursorToRootWindow(); 846 ash_host->ConfineCursorToRootWindow();
846 #endif 847 #endif
847 return ash_host; 848 return ash_host;
848 } 849 }
849 850
850 } // namespace ash 851 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/window_tree_host_manager.h ('k') | ash/display/window_tree_host_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698