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

Side by Side Diff: content/public/test/content_browser_test_utils_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 unified diff | Download patch
« no previous file with comments | « content/browser/web_contents/web_contents_view_mac.mm ('k') | ui/base/test/ui_controls_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/public/test/content_browser_test_utils.h" 5 #include "content/public/test/content_browser_test_utils.h"
6 6
7 #include <Carbon/Carbon.h> 7 #include <Carbon/Carbon.h>
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 #include "ui/gfx/geometry/rect.h" 10 #include "ui/gfx/geometry/rect.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds) { 14 void SetWindowBounds(gfx::NativeWindow window, const gfx::Rect& bounds) {
15 NSRect new_bounds = NSRectFromCGRect(bounds.ToCGRect()); 15 NSRect new_bounds = NSRectFromCGRect(bounds.ToCGRect());
16 if ([[NSScreen screens] count] > 0) { 16 if ([[NSScreen screens] count] > 0) {
17 new_bounds.origin.y = 17 new_bounds.origin.y =
18 [[[NSScreen screens] objectAtIndex:0] frame].size.height - 18 [[[NSScreen screens] firstObject] frame].size.height -
19 new_bounds.origin.y - new_bounds.size.height; 19 new_bounds.origin.y - new_bounds.size.height;
20 } 20 }
21 21
22 [window setFrame:new_bounds display:NO]; 22 [window setFrame:new_bounds display:NO];
23 } 23 }
24 24
25 } // namespace content 25 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_view_mac.mm ('k') | ui/base/test/ui_controls_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698