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

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

Issue 1945903002: Move display_finder to ui/display (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
« ui/gfx/gfx.gyp ('K') | « ui/views/mus/BUILD.gn ('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 "mojo/converters/geometry/geometry_type_converters.h" 7 #include "mojo/converters/geometry/geometry_type_converters.h"
8 #include "services/shell/public/cpp/connection.h" 8 #include "services/shell/public/cpp/connection.h"
9 #include "services/shell/public/cpp/connector.h" 9 #include "services/shell/public/cpp/connector.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
11 #include "ui/display/display_finder.h"
11 #include "ui/display/display_observer.h" 12 #include "ui/display/display_observer.h"
12 #include "ui/gfx/display_finder.h"
13 #include "ui/views/mus/screen_mus_delegate.h" 13 #include "ui/views/mus/screen_mus_delegate.h"
14 #include "ui/views/mus/window_manager_frame_values.h" 14 #include "ui/views/mus/window_manager_frame_values.h"
15 15
16 namespace mojo { 16 namespace mojo {
17 17
18 template <> 18 template <>
19 struct TypeConverter<display::Display, mus::mojom::DisplayPtr> { 19 struct TypeConverter<display::Display, mus::mojom::DisplayPtr> {
20 static display::Display Convert(const mus::mojom::DisplayPtr& input) { 20 static display::Display Convert(const mus::mojom::DisplayPtr& input) {
21 display::Display result(input->id); 21 display::Display result(input->id);
22 gfx::Rect pixel_bounds = input->bounds.To<gfx::Rect>(); 22 gfx::Rect pixel_bounds = input->bounds.To<gfx::Rect>();
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } 192 }
193 193
194 display::Display ScreenMus::GetDisplayNearestWindow( 194 display::Display ScreenMus::GetDisplayNearestWindow(
195 gfx::NativeView view) const { 195 gfx::NativeView view) const {
196 //NOTIMPLEMENTED(); 196 //NOTIMPLEMENTED();
197 return GetPrimaryDisplay(); 197 return GetPrimaryDisplay();
198 } 198 }
199 199
200 display::Display ScreenMus::GetDisplayNearestPoint( 200 display::Display ScreenMus::GetDisplayNearestPoint(
201 const gfx::Point& point) const { 201 const gfx::Point& point) const {
202 return *gfx::FindDisplayNearestPoint(displays_, point); 202 return *display::FindDisplayNearestPoint(displays_, point);
203 } 203 }
204 204
205 int ScreenMus::GetNumDisplays() const { 205 int ScreenMus::GetNumDisplays() const {
206 return static_cast<int>(displays_.size()); 206 return static_cast<int>(displays_.size());
207 } 207 }
208 208
209 std::vector<display::Display> ScreenMus::GetAllDisplays() const { 209 std::vector<display::Display> ScreenMus::GetAllDisplays() const {
210 return displays_; 210 return displays_;
211 } 211 }
212 212
213 display::Display ScreenMus::GetDisplayMatching( 213 display::Display ScreenMus::GetDisplayMatching(
214 const gfx::Rect& match_rect) const { 214 const gfx::Rect& match_rect) const {
215 const display::Display* match = 215 const display::Display* match =
216 gfx::FindDisplayWithBiggestIntersection(displays_, match_rect); 216 display::FindDisplayWithBiggestIntersection(displays_, match_rect);
217 return match ? *match : GetPrimaryDisplay(); 217 return match ? *match : GetPrimaryDisplay();
218 } 218 }
219 219
220 void ScreenMus::AddObserver(display::DisplayObserver* observer) { 220 void ScreenMus::AddObserver(display::DisplayObserver* observer) {
221 observers_.AddObserver(observer); 221 observers_.AddObserver(observer);
222 } 222 }
223 223
224 void ScreenMus::RemoveObserver(display::DisplayObserver* observer) { 224 void ScreenMus::RemoveObserver(display::DisplayObserver* observer) {
225 observers_.RemoveObserver(observer); 225 observers_.RemoveObserver(observer);
226 } 226 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 DCHECK_NE(-1, index); 264 DCHECK_NE(-1, index);
265 // Another display must become primary before the existing primary is 265 // Another display must become primary before the existing primary is
266 // removed. 266 // removed.
267 DCHECK_NE(index, primary_display_index_); 267 DCHECK_NE(index, primary_display_index_);
268 const display::Display display = displays_[index]; 268 const display::Display display = displays_[index];
269 FOR_EACH_OBSERVER(display::DisplayObserver, observers_, 269 FOR_EACH_OBSERVER(display::DisplayObserver, observers_,
270 OnDisplayRemoved(display)); 270 OnDisplayRemoved(display));
271 } 271 }
272 272
273 } // namespace views 273 } // namespace views
OLDNEW
« ui/gfx/gfx.gyp ('K') | « ui/views/mus/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698