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/gfx/screen.h" | 5 #include "ui/gfx/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 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } | 120 } |
121 | 121 |
122 virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE { | 122 virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE { |
123 return displays_; | 123 return displays_; |
124 } | 124 } |
125 | 125 |
126 virtual gfx::Display GetDisplayNearestWindow( | 126 virtual gfx::Display GetDisplayNearestWindow( |
127 gfx::NativeView view) const OVERRIDE { | 127 gfx::NativeView view) const OVERRIDE { |
128 NSWindow* window = nil; | 128 NSWindow* window = nil; |
129 #if !defined(USE_AURA) | 129 #if !defined(USE_AURA) |
130 window = [view window]; | 130 if (view) |
| 131 window = [view window]; |
131 #endif | 132 #endif |
132 if (!window) | 133 if (!window) |
133 return GetPrimaryDisplay(); | 134 return GetPrimaryDisplay(); |
134 NSScreen* match_screen = [window screen]; | 135 NSScreen* match_screen = [window screen]; |
135 if (!match_screen) | 136 if (!match_screen) |
136 return GetPrimaryDisplay(); | 137 return GetPrimaryDisplay(); |
137 return GetDisplayForScreen(match_screen); | 138 return GetDisplayForScreen(match_screen); |
138 } | 139 } |
139 | 140 |
140 virtual gfx::Display GetDisplayNearestPoint( | 141 virtual gfx::Display GetDisplayNearestPoint( |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 275 |
275 namespace gfx { | 276 namespace gfx { |
276 | 277 |
277 #if !defined(USE_AURA) | 278 #if !defined(USE_AURA) |
278 Screen* CreateNativeScreen() { | 279 Screen* CreateNativeScreen() { |
279 return new ScreenMac; | 280 return new ScreenMac; |
280 } | 281 } |
281 #endif | 282 #endif |
282 | 283 |
283 } | 284 } |
OLD | NEW |