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

Side by Side Diff: ui/display/display_list.cc

Issue 2314203002: Move DisplayList to display; add ScreenBase. (Closed)
Patch Set: Update unit test namespace. Created 4 years, 3 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 | « ui/display/display_list.h ('k') | ui/display/display_list_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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ui/views/mus/display_list.h" 5 #include "ui/display/display_list.h"
6 6
7 #include "ui/display/display_finder.h"
8 #include "ui/display/display_observer.h" 7 #include "ui/display/display_observer.h"
9 8
10 namespace views { 9 namespace display {
11 10
12 DisplayList::DisplayList() {} 11 DisplayList::DisplayList() {}
13 12
14 DisplayList::~DisplayList() {} 13 DisplayList::~DisplayList() {}
15 14
16 void DisplayList::AddObserver(display::DisplayObserver* observer) { 15 void DisplayList::AddObserver(display::DisplayObserver* observer) {
17 observers_.AddObserver(observer); 16 observers_.AddObserver(observer);
18 } 17 }
19 18
20 void DisplayList::RemoveObserver(display::DisplayObserver* observer) { 19 void DisplayList::RemoveObserver(display::DisplayObserver* observer) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 if (type == Type::PRIMARY) 85 if (type == Type::PRIMARY)
87 primary_display_index_ = static_cast<int>(displays_.size()) - 1; 86 primary_display_index_ = static_cast<int>(displays_.size()) - 1;
88 FOR_EACH_OBSERVER(display::DisplayObserver, observers_, 87 FOR_EACH_OBSERVER(display::DisplayObserver, observers_,
89 OnDisplayAdded(display)); 88 OnDisplayAdded(display));
90 } 89 }
91 90
92 void DisplayList::RemoveDisplay(int64_t id) { 91 void DisplayList::RemoveDisplay(int64_t id) {
93 auto iter = FindDisplayById(id); 92 auto iter = FindDisplayById(id);
94 DCHECK(displays_.end() != iter); 93 DCHECK(displays_.end() != iter);
95 if (primary_display_index_ == static_cast<int>(iter - displays_.begin())) { 94 if (primary_display_index_ == static_cast<int>(iter - displays_.begin())) {
96 // We expect the primary to change before removing it. The only case we 95 // The primary display can only be removed if it is the last display.
97 // allow removal of the primary is if it is the list display. 96 // Users must choose a new primary before removing an old primary display.
98 DCHECK_EQ(1u, displays_.size()); 97 DCHECK_EQ(1u, displays_.size());
99 primary_display_index_ = -1; 98 primary_display_index_ = -1;
100 } else if (primary_display_index_ > 99 } else if (primary_display_index_ >
101 static_cast<int>(iter - displays_.begin())) { 100 static_cast<int>(iter - displays_.begin())) {
102 primary_display_index_--; 101 primary_display_index_--;
103 } 102 }
104 const display::Display display = *iter; 103 const display::Display display = *iter;
105 displays_.erase(iter); 104 displays_.erase(iter);
106 FOR_EACH_OBSERVER(display::DisplayObserver, observers_, 105 FOR_EACH_OBSERVER(display::DisplayObserver, observers_,
107 OnDisplayRemoved(display)); 106 OnDisplayRemoved(display));
108 } 107 }
109 } // namespace views 108 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/display_list.h ('k') | ui/display/display_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698