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

Unified Diff: ash/display/display_util.cc

Issue 1638413007: Use list instead of pair to represent the set of displays. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix build error Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ash/display/display_util.cc
diff --git a/ash/display/display_util.cc b/ash/display/display_util.cc
index ce0232b19e689503d3978030debaea1f908607f7..6f4d9e52c423b4c6be4bbb1279b56eee8852f067 100644
--- a/ash/display/display_util.cc
+++ b/ash/display/display_util.cc
@@ -10,6 +10,7 @@
#include "ash/display/display_manager.h"
#include "ash/host/ash_window_tree_host.h"
#include "ash/shell.h"
+#include "base/strings/string_number_conversions.h"
#include "ui/aura/env.h"
#include "ui/aura/window_tree_host.h"
#include "ui/gfx/display.h"
@@ -348,9 +349,18 @@ int FindDisplayIndexContainingPoint(const std::vector<gfx::Display>& displays,
return iter == displays.end() ? -1 : (iter - displays.begin());
}
-DisplayIdPair CreateDisplayIdPair(int64_t id1, int64_t id2) {
- return CompareDisplayIds(id1, id2) ? std::make_pair(id1, id2)
- : std::make_pair(id2, id1);
+DisplayIdList CreateDisplayIdList(int64_t id1, int64_t id2) {
+ std::vector<int64_t> ids;
+
+ ids.push_back(id1);
+ ids.push_back(id2);
+ std::sort(ids.begin(), ids.end(),
+ [](int64_t a, int64_t b) { return CompareDisplayIds(a, b); });
+ return ids;
+}
+
+std::string DisplayIdListToString(const ash::DisplayIdList& list) {
+ return base::Int64ToString(list[0]) + "," + base::Int64ToString(list[1]);
}
bool CompareDisplayIds(int64_t id1, int64_t id2) {

Powered by Google App Engine
This is Rietveld 408576698