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

Side by Side Diff: ui/display/manager/display_manager_utilities.cc

Issue 2314203002: Move DisplayList to display; add ScreenBase. (Closed)
Patch Set: Update unit test namespace. 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 | « ui/display/manager/display_manager_utilities.h ('k') | ui/display/screen_base.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ui/display/manager/display_manager_utilities.h" 5 #include "ui/display/manager/display_manager_utilities.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/sys_info.h" 10 #include "base/sys_info.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 int FindDisplayIndexContainingPoint( 256 int FindDisplayIndexContainingPoint(
257 const std::vector<display::Display>& displays, 257 const std::vector<display::Display>& displays,
258 const gfx::Point& point_in_screen) { 258 const gfx::Point& point_in_screen) {
259 auto iter = std::find_if(displays.begin(), displays.end(), 259 auto iter = std::find_if(displays.begin(), displays.end(),
260 [point_in_screen](const display::Display& display) { 260 [point_in_screen](const display::Display& display) {
261 return display.bounds().Contains(point_in_screen); 261 return display.bounds().Contains(point_in_screen);
262 }); 262 });
263 return iter == displays.end() ? -1 : (iter - displays.begin()); 263 return iter == displays.end() ? -1 : (iter - displays.begin());
264 } 264 }
265 265
266 display::DisplayIdList CreateDisplayIdList(const display::DisplayList& list) { 266 display::DisplayIdList CreateDisplayIdList(const display::Displays& list) {
267 return GenerateDisplayIdList( 267 return GenerateDisplayIdList(
268 list.begin(), list.end(), 268 list.begin(), list.end(),
269 [](const display::Display& display) { return display.id(); }); 269 [](const display::Display& display) { return display.id(); });
270 } 270 }
271 271
272 void SortDisplayIdList(display::DisplayIdList* ids) { 272 void SortDisplayIdList(display::DisplayIdList* ids) {
273 std::sort(ids->begin(), ids->end(), 273 std::sort(ids->begin(), ids->end(),
274 [](int64_t a, int64_t b) { return CompareDisplayIds(a, b); }); 274 [](int64_t a, int64_t b) { return CompareDisplayIds(a, b); });
275 } 275 }
276 276
(...skipping 12 matching lines...) Expand all
289 // Output index is stored in the first 8 bits. See GetDisplayIdFromEDID 289 // Output index is stored in the first 8 bits. See GetDisplayIdFromEDID
290 // in edid_parser.cc. 290 // in edid_parser.cc.
291 int index_1 = id1 & 0xFF; 291 int index_1 = id1 & 0xFF;
292 int index_2 = id2 & 0xFF; 292 int index_2 = id2 & 0xFF;
293 DCHECK_NE(index_1, index_2) << id1 << " and " << id2; 293 DCHECK_NE(index_1, index_2) << id1 << " and " << id2;
294 return display::Display::IsInternalDisplayId(id1) || 294 return display::Display::IsInternalDisplayId(id1) ||
295 (index_1 < index_2 && !display::Display::IsInternalDisplayId(id2)); 295 (index_1 < index_2 && !display::Display::IsInternalDisplayId(id2));
296 } 296 }
297 297
298 } // namespace display 298 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/manager/display_manager_utilities.h ('k') | ui/display/screen_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698