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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 // The primary display in a mirrored set will be counted, but those that | 228 // The primary display in a mirrored set will be counted, but those that |
229 // mirror it will not be. | 229 // mirror it will not be. |
230 ScreenIdsToScreensMap::iterator foundScreen = | 230 ScreenIdsToScreensMap::iterator foundScreen = |
231 screen_ids_to_screens.find(online_display); | 231 screen_ids_to_screens.find(online_display); |
232 if (foundScreen != screen_ids_to_screens.end()) { | 232 if (foundScreen != screen_ids_to_screens.end()) { |
233 displays.push_back(GetDisplayForScreen(foundScreen->second)); | 233 displays.push_back(GetDisplayForScreen(foundScreen->second)); |
234 } | 234 } |
235 } | 235 } |
236 } | 236 } |
237 | 237 |
238 if (!displays.size()) | 238 return displays.empty() ? std::vector<Display>(1, GetPrimaryDisplay()) |
239 return std::vector<Display>(1, GetPrimaryDisplay()); | 239 : displays; |
240 | |
241 return displays; | |
242 } | 240 } |
243 | 241 |
244 // The displays currently attached to the device. | 242 // The displays currently attached to the device. |
245 std::vector<Display> displays_; | 243 std::vector<Display> displays_; |
246 | 244 |
247 // The timer to delay configuring outputs. See also the comments in | 245 // The timer to delay configuring outputs. See also the comments in |
248 // HandleDisplayReconfiguration(). | 246 // HandleDisplayReconfiguration(). |
249 std::unique_ptr<base::OneShotTimer> configure_timer_; | 247 std::unique_ptr<base::OneShotTimer> configure_timer_; |
250 | 248 |
251 DisplayChangeNotifier change_notifier_; | 249 DisplayChangeNotifier change_notifier_; |
252 | 250 |
253 DISALLOW_COPY_AND_ASSIGN(ScreenMac); | 251 DISALLOW_COPY_AND_ASSIGN(ScreenMac); |
254 }; | 252 }; |
255 | 253 |
256 } // namespace | 254 } // namespace |
257 | 255 |
258 #if !defined(USE_AURA) | 256 #if !defined(USE_AURA) |
259 Screen* CreateNativeScreen() { | 257 Screen* CreateNativeScreen() { |
260 return new ScreenMac; | 258 return new ScreenMac; |
261 } | 259 } |
262 #endif | 260 #endif |
263 | 261 |
264 } // namespace display | 262 } // namespace display |
OLD | NEW |