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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 window = [view window]; | 159 window = [view window]; |
160 #endif | 160 #endif |
161 if (!window) | 161 if (!window) |
162 return GetPrimaryDisplay(); | 162 return GetPrimaryDisplay(); |
163 NSScreen* match_screen = [window screen]; | 163 NSScreen* match_screen = [window screen]; |
164 if (!match_screen) | 164 if (!match_screen) |
165 return GetPrimaryDisplay(); | 165 return GetPrimaryDisplay(); |
166 return GetDisplayForScreen(match_screen); | 166 return GetDisplayForScreen(match_screen); |
167 } | 167 } |
168 | 168 |
| 169 virtual bool GetDisplayColorProfile( |
| 170 gfx::NativeView view, std::vector<char>* color_profile) const OVERRIDE { |
| 171 DCHECK(color_profile->empty()); |
| 172 |
| 173 NSWindow* window = nil; |
| 174 #if !defined(USE_AURA) |
| 175 window = [view window]; |
| 176 #endif |
| 177 if (!window) |
| 178 return false; |
| 179 |
| 180 // TODO(noel): implement. |
| 181 NOTIMPLEMENTED(); |
| 182 return false; |
| 183 } |
| 184 |
169 virtual gfx::Display GetDisplayNearestPoint( | 185 virtual gfx::Display GetDisplayNearestPoint( |
170 const gfx::Point& point) const OVERRIDE { | 186 const gfx::Point& point) const OVERRIDE { |
171 NSPoint ns_point = NSPointFromCGPoint(point.ToCGPoint()); | 187 NSPoint ns_point = NSPointFromCGPoint(point.ToCGPoint()); |
172 | 188 |
173 NSArray* screens = [NSScreen screens]; | 189 NSArray* screens = [NSScreen screens]; |
174 NSScreen* primary = [screens objectAtIndex:0]; | 190 NSScreen* primary = [screens objectAtIndex:0]; |
175 ns_point.y = NSMaxY([primary frame]) - ns_point.y; | 191 ns_point.y = NSMaxY([primary frame]) - ns_point.y; |
176 for (NSScreen* screen in screens) { | 192 for (NSScreen* screen in screens) { |
177 if (NSMouseInRect(ns_point, [screen frame], NO)) | 193 if (NSMouseInRect(ns_point, [screen frame], NO)) |
178 return GetDisplayForScreen(screen); | 194 return GetDisplayForScreen(screen); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 228 |
213 namespace gfx { | 229 namespace gfx { |
214 | 230 |
215 #if !defined(USE_AURA) | 231 #if !defined(USE_AURA) |
216 Screen* CreateNativeScreen() { | 232 Screen* CreateNativeScreen() { |
217 return new ScreenMac; | 233 return new ScreenMac; |
218 } | 234 } |
219 #endif | 235 #endif |
220 | 236 |
221 } | 237 } |
OLD | NEW |