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

Side by Side Diff: chrome/browser/ui/cocoa/extensions/shell_window_cocoa.mm

Issue 10545050: mac: Use NSWidth() and friends in a few more places. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 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 | Annotate | Revision Log
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 "chrome/browser/ui/cocoa/extensions/shell_window_cocoa.h" 5 #include "chrome/browser/ui/cocoa/extensions/shell_window_cocoa.h"
6 6
7 #include "base/sys_string_conversions.h" 7 #include "base/sys_string_conversions.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/cocoa/browser_window_utils.h" 9 #include "chrome/browser/ui/cocoa/browser_window_utils.h"
10 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h" 10 #include "chrome/browser/ui/cocoa/extensions/extension_view_mac.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 bool ShellWindowCocoa::IsFullscreen() const { 67 bool ShellWindowCocoa::IsFullscreen() const {
68 return false; 68 return false;
69 } 69 }
70 70
71 gfx::Rect ShellWindowCocoa::GetRestoredBounds() const { 71 gfx::Rect ShellWindowCocoa::GetRestoredBounds() const {
72 // Flip coordinates based on the primary screen. 72 // Flip coordinates based on the primary screen.
73 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; 73 NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
74 NSRect frame = [window() frame]; 74 NSRect frame = [window() frame];
75 gfx::Rect bounds(frame.origin.x, 0, frame.size.width, frame.size.height); 75 gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame));
76 bounds.set_y([screen frame].size.height - frame.origin.y - frame.size.height); 76 bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame));
77 return bounds; 77 return bounds;
78 } 78 }
79 79
80 gfx::Rect ShellWindowCocoa::GetBounds() const { 80 gfx::Rect ShellWindowCocoa::GetBounds() const {
81 return GetRestoredBounds(); 81 return GetRestoredBounds();
82 } 82 }
83 83
84 void ShellWindowCocoa::Show() { 84 void ShellWindowCocoa::Show() {
85 [window_controller_ showWindow:nil]; 85 [window_controller_ showWindow:nil];
86 [window() makeKeyAndOrderFront:window_controller_]; 86 [window() makeKeyAndOrderFront:window_controller_];
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 if (bounds.width() < min_size.width) 128 if (bounds.width() < min_size.width)
129 checked_bounds.set_width(min_size.width); 129 checked_bounds.set_width(min_size.width);
130 if (bounds.height() < min_size.height) 130 if (bounds.height() < min_size.height)
131 checked_bounds.set_height(min_size.height); 131 checked_bounds.set_height(min_size.height);
132 132
133 NSRect cocoa_bounds = NSMakeRect(checked_bounds.x(), 0, 133 NSRect cocoa_bounds = NSMakeRect(checked_bounds.x(), 0,
134 checked_bounds.width(), 134 checked_bounds.width(),
135 checked_bounds.height()); 135 checked_bounds.height());
136 // Flip coordinates based on the primary screen. 136 // Flip coordinates based on the primary screen.
137 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; 137 NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
138 cocoa_bounds.origin.y = 138 cocoa_bounds.origin.y = NSHeight([screen frame]) - checked_bounds.bottom();
139 [screen frame].size.height - checked_bounds.height() - checked_bounds.y();
140 139
141 [window() setFrame:cocoa_bounds display:YES]; 140 [window() setFrame:cocoa_bounds display:YES];
142 } 141 }
143 142
144 void ShellWindowCocoa::SetDraggableRegion(SkRegion* region) { 143 void ShellWindowCocoa::SetDraggableRegion(SkRegion* region) {
145 // TODO: implement 144 // TODO: implement
146 } 145 }
147 146
148 void ShellWindowCocoa::FlashFrame(bool flash) { 147 void ShellWindowCocoa::FlashFrame(bool flash) {
149 if (flash) { 148 if (flash) {
(...skipping 20 matching lines...) Expand all
170 return [window_controller_ window]; 169 return [window_controller_ window];
171 } 170 }
172 171
173 // static 172 // static
174 ShellWindow* ShellWindow::CreateImpl(Profile* profile, 173 ShellWindow* ShellWindow::CreateImpl(Profile* profile,
175 const extensions::Extension* extension, 174 const extensions::Extension* extension,
176 const GURL& url, 175 const GURL& url,
177 const ShellWindow::CreateParams params) { 176 const ShellWindow::CreateParams params) {
178 return new ShellWindowCocoa(profile, extension, url, params); 177 return new ShellWindowCocoa(profile, extension, url, params);
179 } 178 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698