Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Unified Diff: ui/gfx/screen_mac.mm

Issue 1380083005: Mac: Use [NSArray firstObject] for [NSScreen screens] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/mac/coordinate_conversion_unittest.mm ('k') | ui/message_center/cocoa/popup_collection.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/screen_mac.mm
diff --git a/ui/gfx/screen_mac.mm b/ui/gfx/screen_mac.mm
index abd8549dd86b1eaac369a0b687fac50cdc00546a..e23feedebbfc76b31b3c326ae620924e0367eaa5 100644
--- a/ui/gfx/screen_mac.mm
+++ b/ui/gfx/screen_mac.mm
@@ -24,7 +24,7 @@ const int64 kConfigureDelayMs = 500;
gfx::Rect ConvertCoordinateSystem(NSRect ns_rect) {
// Primary monitor is defined as the monitor with the menubar,
// which is always at index 0.
- NSScreen* primary_screen = [[NSScreen screens] objectAtIndex:0];
+ NSScreen* primary_screen = [[NSScreen screens] firstObject];
float primary_screen_height = [primary_screen frame].size.height;
gfx::Rect rect(NSRectToCGRect(ns_rect));
rect.set_y(primary_screen_height - rect.y() - rect.height());
@@ -58,7 +58,7 @@ gfx::Display GetDisplayForScreen(NSScreen* screen) {
gfx::Display display(display_id, gfx::Rect(NSRectToCGRect(frame)));
NSRect visible_frame = [screen visibleFrame];
- NSScreen* primary = [[NSScreen screens] objectAtIndex:0];
+ NSScreen* primary = [[NSScreen screens] firstObject];
// Convert work area's coordinate systems.
if ([screen isEqual:primary]) {
@@ -103,7 +103,7 @@ class ScreenMac : public gfx::Screen {
gfx::Point GetCursorScreenPoint() override {
NSPoint mouseLocation = [NSEvent mouseLocation];
// Flip coordinates to gfx (0,0 in top-left corner) using primary screen.
- NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
+ NSScreen* screen = [[NSScreen screens] firstObject];
mouseLocation.y = NSMaxY([screen frame]) - mouseLocation.y;
return gfx::Point(mouseLocation.x, mouseLocation.y);
}
@@ -161,7 +161,7 @@ class ScreenMac : public gfx::Screen {
gfx::Display GetPrimaryDisplay() const override {
// Primary display is defined as the display with the menubar,
// which is always at index 0.
- NSScreen* primary = [[NSScreen screens] objectAtIndex:0];
+ NSScreen* primary = [[NSScreen screens] firstObject];
gfx::Display display = GetDisplayForScreen(primary);
return display;
}
« no previous file with comments | « ui/gfx/mac/coordinate_conversion_unittest.mm ('k') | ui/message_center/cocoa/popup_collection.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698