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

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

Issue 1261693004: Allow dynamic enabling/disabling of unified desktop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « ash/display/display_util.h ('k') | ash/display/display_util_unittest.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_util.h" 5 #include "ash/display/display_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/display/display_info.h" 9 #include "ash/display/display_info.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 int FindDisplayIndexContainingPoint(const std::vector<gfx::Display>& displays, 332 int FindDisplayIndexContainingPoint(const std::vector<gfx::Display>& displays,
333 const gfx::Point& point_in_screen) { 333 const gfx::Point& point_in_screen) {
334 auto iter = std::find_if(displays.begin(), displays.end(), 334 auto iter = std::find_if(displays.begin(), displays.end(),
335 [point_in_screen](const gfx::Display& display) { 335 [point_in_screen](const gfx::Display& display) {
336 return display.bounds().Contains(point_in_screen); 336 return display.bounds().Contains(point_in_screen);
337 }); 337 });
338 return iter == displays.end() ? -1 : (iter - displays.begin()); 338 return iter == displays.end() ? -1 : (iter - displays.begin());
339 } 339 }
340 340
341 DisplayIdPair CreateDisplayIdPair(int64 id1, int64 id2) { 341 DisplayIdPair CreateDisplayIdPair(int64 id1, int64 id2) {
342 return CompareDisplayIds(id1, id2) ? std::make_pair(id1, id2)
343 : std::make_pair(id2, id1);
344 }
345
346 bool CompareDisplayIds(int64 id1, int64 id2) {
342 DCHECK_NE(id1, id2); 347 DCHECK_NE(id1, id2);
343 // Output index is stored in the first 8 bits. See GetDisplayIdFromEDID 348 // Output index is stored in the first 8 bits. See GetDisplayIdFromEDID
344 // in edid_parser.cc. 349 // in edid_parser.cc.
345 int index_1 = id1 & 0xFF; 350 int index_1 = id1 & 0xFF;
346 int index_2 = id2 & 0xFF; 351 int index_2 = id2 & 0xFF;
347 if (gfx::Display::IsInternalDisplayId(id2) || index_2 < index_1) 352 DCHECK_NE(index_1, index_2) << id1 << " and " << id2;
348 return std::make_pair(id2, id1); 353 return gfx::Display::IsInternalDisplayId(id1) ||
349 else 354 (index_1 < index_2 && !gfx::Display::IsInternalDisplayId(id2));
350 return std::make_pair(id1, id2);
351 } 355 }
352 356
353 } // namespace ash 357 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_util.h ('k') | ash/display/display_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698