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

Unified Diff: chrome/browser/ui/cocoa/apps/native_app_window_cocoa.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
Index: chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
index 337fe2e32625fba2e9b06e6fd8e618e0497b60f1..bad78a5d933dd530bb95cd759b00e9b835eec7b8 100644
--- a/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm
@@ -57,7 +57,7 @@ const int kActivateThrottlePeriodSeconds = 2;
NSRect GfxToCocoaBounds(gfx::Rect bounds) {
typedef AppWindow::BoundsSpecification BoundsSpecification;
- NSRect main_screen_rect = [[[NSScreen screens] objectAtIndex:0] frame];
+ NSRect main_screen_rect = [[[NSScreen screens] firstObject] frame];
// If coordinates are unspecified, center window on primary screen.
if (bounds.x() == BoundsSpecification::kUnspecifiedPosition)
@@ -452,7 +452,7 @@ gfx::NativeWindow NativeAppWindowCocoa::GetNativeWindow() const {
gfx::Rect NativeAppWindowCocoa::GetRestoredBounds() const {
// Flip coordinates based on the primary screen.
- NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
+ NSScreen* screen = [[NSScreen screens] firstObject];
NSRect frame = restored_bounds_;
gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame));
bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame));
@@ -469,7 +469,7 @@ ui::WindowShowState NativeAppWindowCocoa::GetRestoredState() const {
gfx::Rect NativeAppWindowCocoa::GetBounds() const {
// Flip coordinates based on the primary screen.
- NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
+ NSScreen* screen = [[NSScreen screens] firstObject];
NSRect frame = [window() frame];
gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame));
bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame));
@@ -687,7 +687,7 @@ gfx::Insets NativeAppWindowCocoa::GetFrameInsets() const {
// Flip the coordinates based on the main screen.
NSInteger screen_height =
- NSHeight([[[NSScreen screens] objectAtIndex:0] frame]);
+ NSHeight([[[NSScreen screens] firstObject] frame]);
NSRect frame_nsrect = [window() frame];
gfx::Rect frame_rect(NSRectToCGRect(frame_nsrect));
« no previous file with comments | « chrome/browser/ui/app_list/app_list_service_mac.mm ('k') | chrome/browser/ui/cocoa/autofill/autofill_popup_base_view_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698