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

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

Issue 1924703002: Rename gfx::Display/Screen to display::Display/Screen in ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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_info_unittest.cc ('k') | ash/display/display_manager.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stdio.h> 5 #include <stdio.h>
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/display/display_layout_store.h" 8 #include "ash/display/display_layout_store.h"
9 #include "ash/display/display_manager.h" 9 #include "ash/display/display_manager.h"
10 #include "ash/display/display_util.h" 10 #include "ash/display/display_util.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "ui/gfx/display.h" 14 #include "ui/display/display.h"
15 15
16 namespace ash { 16 namespace ash {
17 17
18 DisplayLayoutStore::DisplayLayoutStore() 18 DisplayLayoutStore::DisplayLayoutStore()
19 : default_display_placement_(display::DisplayPlacement::RIGHT, 0) { 19 : default_display_placement_(display::DisplayPlacement::RIGHT, 0) {
20 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 20 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
21 if (command_line->HasSwitch(switches::kAshSecondaryDisplayLayout)) { 21 if (command_line->HasSwitch(switches::kAshSecondaryDisplayLayout)) {
22 std::string value = command_line->GetSwitchValueASCII( 22 std::string value = command_line->GetSwitchValueASCII(
23 switches::kAshSecondaryDisplayLayout); 23 switches::kAshSecondaryDisplayLayout);
24 char layout; 24 char layout;
(...skipping 30 matching lines...) Expand all
55 if (list.size() == 2 && layout->placement_list.size() > 1) 55 if (list.size() == 2 && layout->placement_list.size() > 1)
56 return; 56 return;
57 57
58 // Do not overwrite the valid data with old invalid date. 58 // Do not overwrite the valid data with old invalid date.
59 if (layouts_.count(list) && !CompareDisplayIds(list[0], list[1])) 59 if (layouts_.count(list) && !CompareDisplayIds(list[0], list[1]))
60 return; 60 return;
61 61
62 // Old data may not have the display_id/parent_display_id. 62 // Old data may not have the display_id/parent_display_id.
63 // Guess these values based on the saved primary_id. 63 // Guess these values based on the saved primary_id.
64 if (layout->placement_list.size() >= 1 && 64 if (layout->placement_list.size() >= 1 &&
65 layout->placement_list[0].display_id == gfx::Display::kInvalidDisplayID) { 65 layout->placement_list[0].display_id ==
66 display::Display::kInvalidDisplayID) {
66 if (layout->primary_id == list[1]) { 67 if (layout->primary_id == list[1]) {
67 layout->placement_list[0].display_id = list[0]; 68 layout->placement_list[0].display_id = list[0];
68 layout->placement_list[0].parent_display_id = list[1]; 69 layout->placement_list[0].parent_display_id = list[1];
69 } else { 70 } else {
70 layout->placement_list[0].display_id = list[1]; 71 layout->placement_list[0].display_id = list[1];
71 layout->placement_list[0].parent_display_id = list[0]; 72 layout->placement_list[0].parent_display_id = list[0];
72 } 73 }
73 } 74 }
74 DCHECK(display::DisplayLayout::Validate(list, *layout.get())) 75 DCHECK(display::DisplayLayout::Validate(list, *layout.get()))
75 << "ids=" << DisplayIdListToString(list) 76 << "ids=" << DisplayIdListToString(list)
76 << ", layout=" << layout->ToString(); 77 << ", layout=" << layout->ToString();
77 layouts_[list] = std::move(layout); 78 layouts_[list] = std::move(layout);
78 } 79 }
79 80
80 const display::DisplayLayout& DisplayLayoutStore::GetRegisteredDisplayLayout( 81 const display::DisplayLayout& DisplayLayoutStore::GetRegisteredDisplayLayout(
81 const display::DisplayIdList& list) { 82 const display::DisplayIdList& list) {
82 DCHECK_NE(1u, list.size()); 83 DCHECK_NE(1u, list.size());
83 const auto iter = layouts_.find(list); 84 const auto iter = layouts_.find(list);
84 const display::DisplayLayout* layout = iter != layouts_.end() 85 const display::DisplayLayout* layout = iter != layouts_.end()
85 ? iter->second.get() 86 ? iter->second.get()
86 : CreateDefaultDisplayLayout(list); 87 : CreateDefaultDisplayLayout(list);
87 DCHECK(display::DisplayLayout::Validate(list, *layout)) << layout->ToString(); 88 DCHECK(display::DisplayLayout::Validate(list, *layout)) << layout->ToString();
88 DCHECK_NE(layout->primary_id, gfx::Display::kInvalidDisplayID); 89 DCHECK_NE(layout->primary_id, display::Display::kInvalidDisplayID);
89 return *layout; 90 return *layout;
90 } 91 }
91 92
92 void DisplayLayoutStore::UpdateMultiDisplayState( 93 void DisplayLayoutStore::UpdateMultiDisplayState(
93 const display::DisplayIdList& list, 94 const display::DisplayIdList& list,
94 bool mirrored, 95 bool mirrored,
95 bool default_unified) { 96 bool default_unified) {
96 DCHECK(layouts_.find(list) != layouts_.end()); 97 DCHECK(layouts_.find(list) != layouts_.end());
97 if (layouts_.find(list) == layouts_.end()) 98 if (layouts_.find(list) == layouts_.end())
98 CreateDefaultDisplayLayout(list); 99 CreateDefaultDisplayLayout(list);
(...skipping 13 matching lines...) Expand all
112 placement.display_id = list[i + 1]; 113 placement.display_id = list[i + 1];
113 placement.parent_display_id = list[i]; 114 placement.parent_display_id = list[i];
114 layout->placement_list.push_back(placement); 115 layout->placement_list.push_back(placement);
115 } 116 }
116 layouts_[list] = std::move(layout); 117 layouts_[list] = std::move(layout);
117 auto iter = layouts_.find(list); 118 auto iter = layouts_.find(list);
118 return iter->second.get(); 119 return iter->second.get();
119 } 120 }
120 121
121 } // namespace ash 122 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_info_unittest.cc ('k') | ash/display/display_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698