OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/display/screen.h" | 5 #include "ui/display/screen.h" |
6 | 6 |
7 #import <ApplicationServices/ApplicationServices.h> | 7 #import <ApplicationServices/ApplicationServices.h> |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 // The primary display in a mirrored set will be counted, but those that | 255 // The primary display in a mirrored set will be counted, but those that |
256 // mirror it will not be. | 256 // mirror it will not be. |
257 ScreenIdsToScreensMap::iterator foundScreen = | 257 ScreenIdsToScreensMap::iterator foundScreen = |
258 screen_ids_to_screens.find(online_display); | 258 screen_ids_to_screens.find(online_display); |
259 if (foundScreen != screen_ids_to_screens.end()) { | 259 if (foundScreen != screen_ids_to_screens.end()) { |
260 displays.push_back(GetDisplayForScreen(foundScreen->second)); | 260 displays.push_back(GetDisplayForScreen(foundScreen->second)); |
261 } | 261 } |
262 } | 262 } |
263 } | 263 } |
264 | 264 |
265 if (!displays.size()) | 265 return displays.empty() ? std::vector<Display>(1, GetPrimaryDisplay()) |
266 return std::vector<Display>(1, GetPrimaryDisplay()); | 266 : displays; |
267 | |
268 return displays; | |
269 } | 267 } |
270 | 268 |
271 // The displays currently attached to the device. | 269 // The displays currently attached to the device. |
272 std::vector<Display> displays_; | 270 std::vector<Display> displays_; |
273 | 271 |
274 // The timer to delay configuring outputs. See also the comments in | 272 // The timer to delay configuring outputs. See also the comments in |
275 // HandleDisplayReconfiguration(). | 273 // HandleDisplayReconfiguration(). |
276 std::unique_ptr<base::OneShotTimer> configure_timer_; | 274 std::unique_ptr<base::OneShotTimer> configure_timer_; |
277 | 275 |
278 DisplayChangeNotifier change_notifier_; | 276 DisplayChangeNotifier change_notifier_; |
279 | 277 |
280 DISALLOW_COPY_AND_ASSIGN(ScreenMac); | 278 DISALLOW_COPY_AND_ASSIGN(ScreenMac); |
281 }; | 279 }; |
282 | 280 |
283 } // namespace | 281 } // namespace |
284 | 282 |
285 #if !defined(USE_AURA) | 283 #if !defined(USE_AURA) |
286 Screen* CreateNativeScreen() { | 284 Screen* CreateNativeScreen() { |
287 return new ScreenMac; | 285 return new ScreenMac; |
288 } | 286 } |
289 #endif | 287 #endif |
290 | 288 |
291 } // namespace display | 289 } // namespace display |
OLD | NEW |