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

Unified Diff: ui/display/manager/display_layout_store.cc

Issue 2286523002: Relocate reuseable portions of ash/display/display_util.* (Closed)
Patch Set: fixed ozone build 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 side-by-side diff with in-line comments
Download patch
Index: ui/display/manager/display_layout_store.cc
diff --git a/ui/display/manager/display_layout_store.cc b/ui/display/manager/display_layout_store.cc
index b9b9a8f5239b2ae841a5884e5634ff15fdf297c1..463fc6cda2b4c7b35e2eefd0f30a01576c2b85ba 100644
--- a/ui/display/manager/display_layout_store.cc
+++ b/ui/display/manager/display_layout_store.cc
@@ -12,35 +12,10 @@
#include "ui/display/display.h"
#include "ui/display/display_switches.h"
#include "ui/display/manager/display_layout_store.h"
+#include "ui/display/manager/display_manager_utilities.h"
namespace display {
-namespace {
-
-// TODO(kylechar): Move these to ui/display/chromeos/display_util.cc/h.
-bool CompareDisplayIds(int64_t id1, int64_t id2) {
- DCHECK_NE(id1, id2);
- // Output index is stored in the first 8 bits. See GetDisplayIdFromEDID
- // in edid_parser.cc.
- int index_1 = id1 & 0xFF;
- int index_2 = id2 & 0xFF;
- DCHECK_NE(index_1, index_2) << id1 << " and " << id2;
- return Display::IsInternalDisplayId(id1) ||
- (index_1 < index_2 && !Display::IsInternalDisplayId(id2));
-}
-
-std::string DisplayIdListToString(const DisplayIdList& list) {
- std::stringstream s;
- const char* sep = "";
- for (int64_t id : list) {
- s << sep << id;
- sep = ",";
- }
- return s.str();
-}
-
-} // namespace
-
DisplayLayoutStore::DisplayLayoutStore()
: default_display_placement_(display::DisplayPlacement::RIGHT, 0) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
@@ -81,7 +56,7 @@ void DisplayLayoutStore::RegisterLayoutForDisplayIdList(
return;
// Do not overwrite the valid data with old invalid date.
- if (layouts_.count(list) && !CompareDisplayIds(list[0], list[1]))
+ if (layouts_.count(list) && !ui::CompareDisplayIds(list[0], list[1]))
return;
// Old data may not have the display_id/parent_display_id.
@@ -98,7 +73,7 @@ void DisplayLayoutStore::RegisterLayoutForDisplayIdList(
}
}
DCHECK(display::DisplayLayout::Validate(list, *layout.get()))
- << "ids=" << DisplayIdListToString(list)
+ << "ids=" << ui::DisplayIdListToString(list)
<< ", layout=" << layout->ToString();
layouts_[list] = std::move(layout);
}

Powered by Google App Engine
This is Rietveld 408576698