| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 147 } |
| 148 | 148 |
| 149 if (!displays.size()) | 149 if (!displays.size()) |
| 150 return std::vector<gfx::Display>(1, GetPrimaryDisplay()); | 150 return std::vector<gfx::Display>(1, GetPrimaryDisplay()); |
| 151 | 151 |
| 152 return displays; | 152 return displays; |
| 153 } | 153 } |
| 154 | 154 |
| 155 virtual gfx::Display GetDisplayNearestWindow( | 155 virtual gfx::Display GetDisplayNearestWindow( |
| 156 gfx::NativeView view) const OVERRIDE { | 156 gfx::NativeView view) const OVERRIDE { |
| 157 NSWindow* window = [view window]; | 157 NSWindow* window = nil; |
| 158 #if !defined(USE_AURA) |
| 159 window = [view window]; |
| 160 #endif |
| 158 if (!window) | 161 if (!window) |
| 159 return GetPrimaryDisplay(); | 162 return GetPrimaryDisplay(); |
| 160 NSScreen* match_screen = [window screen]; | 163 NSScreen* match_screen = [window screen]; |
| 161 if (!match_screen) | 164 if (!match_screen) |
| 162 return GetPrimaryDisplay(); | 165 return GetPrimaryDisplay(); |
| 163 return GetDisplayForScreen(match_screen); | 166 return GetDisplayForScreen(match_screen); |
| 164 } | 167 } |
| 165 | 168 |
| 166 virtual gfx::Display GetDisplayNearestPoint( | 169 virtual gfx::Display GetDisplayNearestPoint( |
| 167 const gfx::Point& point) const OVERRIDE { | 170 const gfx::Point& point) const OVERRIDE { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 } | 205 } |
| 203 | 206 |
| 204 private: | 207 private: |
| 205 DISALLOW_COPY_AND_ASSIGN(ScreenMac); | 208 DISALLOW_COPY_AND_ASSIGN(ScreenMac); |
| 206 }; | 209 }; |
| 207 | 210 |
| 208 } // namespace | 211 } // namespace |
| 209 | 212 |
| 210 namespace gfx { | 213 namespace gfx { |
| 211 | 214 |
| 215 #if !defined(USE_AURA) |
| 212 Screen* CreateNativeScreen() { | 216 Screen* CreateNativeScreen() { |
| 213 return new ScreenMac; | 217 return new ScreenMac; |
| 214 } | 218 } |
| 219 #endif |
| 215 | 220 |
| 216 } | 221 } |
| OLD | NEW |