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

Side by Side Diff: ui/views/mus/screen_mus.cc

Issue 2161993002: Start using display.mojom.Display in mus+ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@display_traits
Patch Set: Fixes. Created 4 years, 5 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/views/mus/screen_mus.h ('k') | no next file » | 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/screen_mus.h" 5 #include "ui/views/mus/screen_mus.h"
6 6
7 #include "services/shell/public/cpp/connection.h" 7 #include "services/shell/public/cpp/connection.h"
8 #include "services/shell/public/cpp/connector.h" 8 #include "services/shell/public/cpp/connector.h"
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 #include "ui/display/display_finder.h" 10 #include "ui/display/display_finder.h"
11 #include "ui/display/display_observer.h" 11 #include "ui/display/display_observer.h"
12 #include "ui/display/mojo/display_type_converters.h"
13 #include "ui/views/mus/screen_mus_delegate.h" 12 #include "ui/views/mus/screen_mus_delegate.h"
14 #include "ui/views/mus/window_manager_frame_values.h" 13 #include "ui/views/mus/window_manager_frame_values.h"
15 14
16 #ifdef NOTIMPLEMENTED 15 #ifdef NOTIMPLEMENTED
17 #undef NOTIMPLEMENTED 16 #undef NOTIMPLEMENTED
18 #define NOTIMPLEMENTED() DVLOG(1) << "notimplemented" 17 #define NOTIMPLEMENTED() DVLOG(1) << "notimplemented"
19 #endif 18 #endif
20 19
21 namespace mojo { 20 namespace mojo {
22 21
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 142 }
144 143
145 void ScreenMus::AddObserver(display::DisplayObserver* observer) { 144 void ScreenMus::AddObserver(display::DisplayObserver* observer) {
146 display_list_.AddObserver(observer); 145 display_list_.AddObserver(observer);
147 } 146 }
148 147
149 void ScreenMus::RemoveObserver(display::DisplayObserver* observer) { 148 void ScreenMus::RemoveObserver(display::DisplayObserver* observer) {
150 display_list_.RemoveObserver(observer); 149 display_list_.RemoveObserver(observer);
151 } 150 }
152 151
153 void ScreenMus::OnDisplays( 152 void ScreenMus::OnDisplays(mojo::Array<ui::mojom::WsDisplayPtr> ws_displays) {
154 mojo::Array<ui::mojom::DisplayPtr> transport_displays) {
155 // This should only be called once from Init() before any observers have been 153 // This should only be called once from Init() before any observers have been
156 // added. 154 // added.
157 DCHECK(display_list_.displays().empty()); 155 DCHECK(display_list_.displays().empty());
158 std::vector<display::Display> displays = 156 for (size_t i = 0; i < ws_displays.size(); ++i) {
159 transport_displays.To<std::vector<display::Display>>(); 157 const bool is_primary = ws_displays[i]->is_primary;
160 for (size_t i = 0; i < displays.size(); ++i) { 158 display_list_.AddDisplay(ws_displays[i]->display,
161 const bool is_primary = transport_displays[i]->is_primary; 159 is_primary ? DisplayList::Type::PRIMARY
162 display_list_.AddDisplay(displays[i], is_primary 160 : DisplayList::Type::NOT_PRIMARY);
163 ? DisplayList::Type::PRIMARY
164 : DisplayList::Type::NOT_PRIMARY);
165 if (is_primary) { 161 if (is_primary) {
166 // TODO(sky): Make WindowManagerFrameValues per display. 162 // TODO(sky): Make WindowManagerFrameValues per display.
167 WindowManagerFrameValues frame_values = 163 WindowManagerFrameValues frame_values =
168 transport_displays[i] 164 ws_displays[i]
169 ->frame_decoration_values.To<WindowManagerFrameValues>(); 165 ->frame_decoration_values.To<WindowManagerFrameValues>();
170 WindowManagerFrameValues::SetInstance(frame_values); 166 WindowManagerFrameValues::SetInstance(frame_values);
171 } 167 }
172 } 168 }
173 DCHECK(!display_list_.displays().empty()); 169 DCHECK(!display_list_.displays().empty());
174 } 170 }
175 171
176 void ScreenMus::OnDisplaysChanged( 172 void ScreenMus::OnDisplaysChanged(
177 mojo::Array<ui::mojom::DisplayPtr> transport_displays) { 173 mojo::Array<ui::mojom::WsDisplayPtr> ws_displays) {
178 for (size_t i = 0; i < transport_displays.size(); ++i) { 174 for (size_t i = 0; i < ws_displays.size(); ++i) {
179 const bool is_primary = transport_displays[i]->is_primary; 175 const bool is_primary = ws_displays[i]->is_primary;
180 ProcessDisplayChanged(transport_displays[i].To<display::Display>(), 176 ProcessDisplayChanged(ws_displays[i]->display, is_primary);
181 is_primary);
182 if (is_primary) { 177 if (is_primary) {
183 WindowManagerFrameValues frame_values = 178 WindowManagerFrameValues frame_values =
184 transport_displays[i] 179 ws_displays[i]
185 ->frame_decoration_values.To<WindowManagerFrameValues>(); 180 ->frame_decoration_values.To<WindowManagerFrameValues>();
186 WindowManagerFrameValues::SetInstance(frame_values); 181 WindowManagerFrameValues::SetInstance(frame_values);
187 if (delegate_) 182 if (delegate_)
188 delegate_->OnWindowManagerFrameValuesChanged(); 183 delegate_->OnWindowManagerFrameValuesChanged();
189 } 184 }
190 } 185 }
191 } 186 }
192 187
193 void ScreenMus::OnDisplayRemoved(int64_t id) { 188 void ScreenMus::OnDisplayRemoved(int64_t id) {
194 display_list_.RemoveDisplay(id); 189 display_list_.RemoveDisplay(id);
195 } 190 }
196 191
197 } // namespace views 192 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/mus/screen_mus.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698