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

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

Issue 2223063003: Move DisplayLayoutStore from ash to ui. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase/add TODO. 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
« no previous file with comments | « ui/display/manager/display_layout_store.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/display/manager/display_layout_store.cc
diff --git a/ash/display/display_layout_store.cc b/ui/display/manager/display_layout_store.cc
similarity index 79%
rename from ash/display/display_layout_store.cc
rename to ui/display/manager/display_layout_store.cc
index 2d76122294f19dd637407dfeceb6db74877a13de..b9b9a8f5239b2ae841a5884e5634ff15fdf297c1 100644
--- a/ash/display/display_layout_store.cc
+++ b/ui/display/manager/display_layout_store.cc
@@ -4,23 +4,49 @@
#include <stdio.h>
-#include "ash/common/ash_switches.h"
-#include "ash/display/display_layout_store.h"
-#include "ash/display/display_manager.h"
-#include "ash/display/display_util.h"
-#include "ash/shell.h"
+#include <string>
+#include <utility>
+
#include "base/command_line.h"
#include "base/logging.h"
#include "ui/display/display.h"
+#include "ui/display/display_switches.h"
+#include "ui/display/manager/display_layout_store.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 ash {
+} // namespace
DisplayLayoutStore::DisplayLayoutStore()
: default_display_placement_(display::DisplayPlacement::RIGHT, 0) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- if (command_line->HasSwitch(switches::kAshSecondaryDisplayLayout)) {
+ if (command_line->HasSwitch(switches::kSecondaryDisplayLayout)) {
std::string value =
- command_line->GetSwitchValueASCII(switches::kAshSecondaryDisplayLayout);
+ command_line->GetSwitchValueASCII(switches::kSecondaryDisplayLayout);
char layout;
int offset = 0;
if (sscanf(value.c_str(), "%c,%d", &layout, &offset) == 2) {
@@ -42,7 +68,7 @@ DisplayLayoutStore::~DisplayLayoutStore() {}
void DisplayLayoutStore::SetDefaultDisplayPlacement(
const display::DisplayPlacement& placement) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
- if (!command_line->HasSwitch(switches::kAshSecondaryDisplayLayout))
+ if (!command_line->HasSwitch(switches::kSecondaryDisplayLayout))
default_display_placement_ = placement;
}
@@ -118,4 +144,4 @@ display::DisplayLayout* DisplayLayoutStore::CreateDefaultDisplayLayout(
return iter->second.get();
}
-} // namespace ash
+} // namespace display
« no previous file with comments | « ui/display/manager/display_layout_store.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698