| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 NOTIMPLEMENTED(); | 131 NOTIMPLEMENTED(); |
| 132 return gfx::NativeWindow(); | 132 return gfx::NativeWindow(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 int GetNumDisplays() const override { return GetAllDisplays().size(); } | 135 int GetNumDisplays() const override { return GetAllDisplays().size(); } |
| 136 | 136 |
| 137 std::vector<Display> GetAllDisplays() const override { | 137 std::vector<Display> GetAllDisplays() const override { |
| 138 return displays_; | 138 return displays_; |
| 139 } | 139 } |
| 140 | 140 |
| 141 bool GetDisplayWithDisplayId(int64_t display_id, |
| 142 Display* display) const override { |
| 143 for (const Display& display_in_list : displays_) { |
| 144 if (display_in_list.id() == display_id) { |
| 145 *display = display_in_list; |
| 146 return true; |
| 147 } |
| 148 } |
| 149 return false; |
| 150 } |
| 151 |
| 141 Display GetDisplayNearestWindow(gfx::NativeView view) const override { | 152 Display GetDisplayNearestWindow(gfx::NativeView view) const override { |
| 142 NSWindow* window = nil; | 153 NSWindow* window = nil; |
| 143 #if !defined(USE_AURA) | 154 #if !defined(USE_AURA) |
| 144 if (view) | 155 if (view) |
| 145 window = [view window]; | 156 window = [view window]; |
| 146 #endif | 157 #endif |
| 147 if (!window) | 158 if (!window) |
| 148 return GetPrimaryDisplay(); | 159 return GetPrimaryDisplay(); |
| 149 NSScreen* match_screen = [window screen]; | 160 NSScreen* match_screen = [window screen]; |
| 150 if (!match_screen) | 161 if (!match_screen) |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 302 |
| 292 } // namespace | 303 } // namespace |
| 293 | 304 |
| 294 #if !defined(USE_AURA) | 305 #if !defined(USE_AURA) |
| 295 Screen* CreateNativeScreen() { | 306 Screen* CreateNativeScreen() { |
| 296 return new ScreenMac; | 307 return new ScreenMac; |
| 297 } | 308 } |
| 298 #endif | 309 #endif |
| 299 | 310 |
| 300 } // namespace display | 311 } // namespace display |
| OLD | NEW |