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

Side by Side Diff: ash/test/display_manager_test_api.cc

Issue 2196923002: Make ash::DisplayMode more like ui::DisplayMode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments 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/test/display_manager_test_api.h" 5 #include "ash/test/display_manager_test_api.h"
6 6
7 #include <cstdarg> 7 #include <cstdarg>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/common/ash_switches.h" 10 #include "ash/common/ash_switches.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 DisplayManagerTestApi().SetInternalDisplayId(id); 148 DisplayManagerTestApi().SetInternalDisplayId(id);
149 } 149 }
150 150
151 ScopedSetInternalDisplayId::~ScopedSetInternalDisplayId() { 151 ScopedSetInternalDisplayId::~ScopedSetInternalDisplayId() {
152 display::Display::SetInternalDisplayId(display::Display::kInvalidDisplayID); 152 display::Display::SetInternalDisplayId(display::Display::kInvalidDisplayID);
153 } 153 }
154 154
155 bool SetDisplayResolution(int64_t display_id, const gfx::Size& resolution) { 155 bool SetDisplayResolution(int64_t display_id, const gfx::Size& resolution) {
156 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 156 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
157 const DisplayInfo& info = display_manager->GetDisplayInfo(display_id); 157 const DisplayInfo& info = display_manager->GetDisplayInfo(display_id);
158 DisplayMode mode; 158 scoped_refptr<DisplayMode> mode =
159 if (!GetDisplayModeForResolution(info, resolution, &mode)) 159 GetDisplayModeForResolution(info, resolution);
160 if (!mode)
160 return false; 161 return false;
161 return display_manager->SetDisplayMode(display_id, mode); 162 return display_manager->SetDisplayMode(display_id, mode);
162 } 163 }
163 164
164 void SwapPrimaryDisplay() { 165 void SwapPrimaryDisplay() {
165 if (display::Screen::GetScreen()->GetNumDisplays() <= 1) 166 if (display::Screen::GetScreen()->GetNumDisplays() <= 1)
166 return; 167 return;
167 Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId( 168 Shell::GetInstance()->window_tree_host_manager()->SetPrimaryDisplayId(
168 ScreenUtil::GetSecondaryDisplay().id()); 169 ScreenUtil::GetSecondaryDisplay().id());
169 } 170 }
(...skipping 26 matching lines...) Expand all
196 for (size_t i = 0; i < count; i++) { 197 for (size_t i = 0; i < count; i++) {
197 int64_t id = va_arg(args, int64_t); 198 int64_t id = va_arg(args, int64_t);
198 list.push_back(id); 199 list.push_back(id);
199 } 200 }
200 SortDisplayIdList(&list); 201 SortDisplayIdList(&list);
201 return list; 202 return list;
202 } 203 }
203 204
204 } // namespace test 205 } // namespace test
205 } // namespace ash 206 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698