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

Side by Side Diff: chrome/browser/cocoa/browser_window_controller.mm

Issue 337019: Mac: Fix (window modal) sheet placement when bookmark bar is present. (Closed)
Patch Set: Updated comments per jrg's review. Created 11 years, 1 month 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 | « no previous file | no next file » | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <Carbon/Carbon.h> 5 #include <Carbon/Carbon.h>
6 6
7 #include "base/mac_util.h" 7 #include "base/mac_util.h"
8 #include "base/scoped_nsdisable_screen_updates.h" 8 #include "base/scoped_nsdisable_screen_updates.h"
9 #import "base/scoped_nsobject.h" 9 #import "base/scoped_nsobject.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 windowPreferences->SetBoolean(L"always_on_top", false); 1218 windowPreferences->SetBoolean(L"always_on_top", false);
1219 windowPreferences->SetInteger(L"work_area_left", workArea.x()); 1219 windowPreferences->SetInteger(L"work_area_left", workArea.x());
1220 windowPreferences->SetInteger(L"work_area_top", workArea.y()); 1220 windowPreferences->SetInteger(L"work_area_top", workArea.y());
1221 windowPreferences->SetInteger(L"work_area_right", workArea.right()); 1221 windowPreferences->SetInteger(L"work_area_right", workArea.right());
1222 windowPreferences->SetInteger(L"work_area_bottom", workArea.bottom()); 1222 windowPreferences->SetInteger(L"work_area_bottom", workArea.bottom());
1223 } 1223 }
1224 1224
1225 - (NSRect)window:(NSWindow*)window 1225 - (NSRect)window:(NSWindow*)window
1226 willPositionSheet:(NSWindow*)sheet 1226 willPositionSheet:(NSWindow*)sheet
1227 usingRect:(NSRect)defaultSheetRect { 1227 usingRect:(NSRect)defaultSheetRect {
1228 // Any sheet should come from right above the visible content area. 1228 // Any sheet should come from right above the apparent content area, or
1229 // equivalently right below the apparent toolbar.
1229 NSRect toolbarFrame = [[toolbarController_ view] frame]; 1230 NSRect toolbarFrame = [[toolbarController_ view] frame];
1230 NSRect infobarFrame = [[infoBarContainerController_ view] frame]; 1231 defaultSheetRect.origin.y = toolbarFrame.origin.y;
1231 defaultSheetRect.origin.y = toolbarFrame.origin.y - infobarFrame.size.height; 1232
1233 // Position as follows:
1234 // - On a normal (non-NTP) page, position the sheet under the bookmark bar if
1235 // it's visible. Else put it immediately below the normal toolbar.
1236 // - On the NTP, if the bookmark bar is enabled ("always visible"), then it
1237 // looks like a normal bookmark bar, so position the sheet under it; if it
1238 // isn't enabled, the bookmark bar will look as if it's a part of the
1239 // content area, so just put it immediately below the toolbar.
1240 if ([bookmarkBarController_ isVisible] &&
1241 (![bookmarkBarController_ isNewTabPage] ||
1242 [bookmarkBarController_ isAlwaysVisible])) {
1243 NSRect bookmarkBarFrame = [[bookmarkBarController_ view] frame];
1244 defaultSheetRect.origin.y -= bookmarkBarFrame.size.height;
Scott Hess - ex-Googler 2009/10/26 17:04:07 What is wrong with bookmarkBarFrame.origin.y, here
1245 }
1232 1246
1233 return defaultSheetRect; 1247 return defaultSheetRect;
1234 } 1248 }
1235 1249
1236 // Undocumented method for multi-touch gestures in 10.5. Future OS's will 1250 // Undocumented method for multi-touch gestures in 10.5. Future OS's will
1237 // likely add a public API, but the worst that will happen is that this will 1251 // likely add a public API, but the worst that will happen is that this will
1238 // turn into dead code and just won't get called. 1252 // turn into dead code and just won't get called.
1239 - (void)swipeWithEvent:(NSEvent*)event { 1253 - (void)swipeWithEvent:(NSEvent*)event {
1240 // Map forwards and backwards to history; left is positive, right is negative. 1254 // Map forwards and backwards to history; left is positive, right is negative.
1241 unsigned int command = 0; 1255 unsigned int command = 0;
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
1536 if (frameOverlayInactiveImage) { 1550 if (frameOverlayInactiveImage) {
1537 [theme setValue:frameOverlayInactiveImage 1551 [theme setValue:frameOverlayInactiveImage
1538 forAttribute:@"overlay" 1552 forAttribute:@"overlay"
1539 style:GTMThemeStyleWindow 1553 style:GTMThemeStyleWindow
1540 state:GTMThemeStateInactiveWindow]; 1554 state:GTMThemeStateInactiveWindow];
1541 } 1555 }
1542 1556
1543 return theme; 1557 return theme;
1544 } 1558 }
1545 @end 1559 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698