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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 420413002: Ensure dialogs are centered on browser windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h" 5 #import "chrome/browser/ui/cocoa/browser_window_controller_private.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 15 matching lines...) Expand all
26 #import "chrome/browser/ui/cocoa/fullscreen_mode_controller.h" 26 #import "chrome/browser/ui/cocoa/fullscreen_mode_controller.h"
27 #import "chrome/browser/ui/cocoa/fullscreen_window.h" 27 #import "chrome/browser/ui/cocoa/fullscreen_window.h"
28 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" 28 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h"
29 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" 29 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h"
30 #import "chrome/browser/ui/cocoa/nsview_additions.h" 30 #import "chrome/browser/ui/cocoa/nsview_additions.h"
31 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h" 31 #import "chrome/browser/ui/cocoa/presentation_mode_controller.h"
32 #import "chrome/browser/ui/cocoa/profiles/avatar_button_controller.h" 32 #import "chrome/browser/ui/cocoa/profiles/avatar_button_controller.h"
33 #import "chrome/browser/ui/cocoa/profiles/avatar_icon_controller.h" 33 #import "chrome/browser/ui/cocoa/profiles/avatar_icon_controller.h"
34 #import "chrome/browser/ui/cocoa/status_bubble_mac.h" 34 #import "chrome/browser/ui/cocoa/status_bubble_mac.h"
35 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h" 35 #import "chrome/browser/ui/cocoa/tab_contents/overlayable_contents_controller.h"
36 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
37 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h" 36 #import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
38 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 37 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
39 #import "chrome/browser/ui/cocoa/version_independent_window.h" 38 #import "chrome/browser/ui/cocoa/version_independent_window.h"
40 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.h" 39 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_cocoa.h"
41 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" 40 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
42 #include "chrome/browser/ui/tabs/tab_strip_model.h" 41 #include "chrome/browser/ui/tabs/tab_strip_model.h"
43 #include "chrome/common/chrome_switches.h" 42 #include "chrome/common/chrome_switches.h"
44 #include "chrome/common/pref_names.h" 43 #include "chrome/common/pref_names.h"
45 #include "content/public/browser/render_widget_host_view.h" 44 #include "content/public/browser/render_widget_host_view.h"
46 #include "content/public/browser/web_contents.h" 45 #include "content/public/browser/web_contents.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 // Place the download shelf, if any, at the bottom of the view. 279 // Place the download shelf, if any, at the bottom of the view.
281 minY = [self layoutDownloadShelfAtMinX:minX minY:minY width:width]; 280 minY = [self layoutDownloadShelfAtMinX:minX minY:minY width:width];
282 281
283 // Finally, the content area takes up all of the remaining space. 282 // Finally, the content area takes up all of the remaining space.
284 NSRect contentAreaRect = NSMakeRect(minX, minY, width, maxY - minY); 283 NSRect contentAreaRect = NSMakeRect(minX, minY, width, maxY - minY);
285 [self layoutTabContentArea:contentAreaRect]; 284 [self layoutTabContentArea:contentAreaRect];
286 285
287 // Normally, we don't need to tell the toolbar whether or not to show the 286 // Normally, we don't need to tell the toolbar whether or not to show the
288 // divider, but things break down during animation. 287 // divider, but things break down during animation.
289 [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]]; 288 [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]];
290
291 // Update the position of the active constrained window sheet. We force this
292 // here because the |sheetParentView| may not have been resized (e.g., to
293 // prevent jank during a fullscreen mode transition), but constrained window
294 // sheets also compute their position based on the bookmark bar and toolbar.
295 content::WebContents* const activeWebContents =
296 browser_->tab_strip_model()->GetActiveWebContents();
297 NSView* const sheetParentView = activeWebContents ?
298 GetSheetParentViewForWebContents(activeWebContents) : nil;
299 if (sheetParentView) {
300 [[NSNotificationCenter defaultCenter]
301 postNotificationName:NSViewFrameDidChangeNotification
302 object:sheetParentView];
303 }
304 } 289 }
305 290
306 - (CGFloat)floatingBarHeight { 291 - (CGFloat)floatingBarHeight {
307 if (![self inPresentationMode]) 292 if (![self inPresentationMode])
308 return 0; 293 return 0;
309 294
310 CGFloat totalHeight = [presentationModeController_ floatingBarVerticalOffset]; 295 CGFloat totalHeight = [presentationModeController_ floatingBarVerticalOffset];
311 296
312 if ([self hasTabStrip]) 297 if ([self hasTabStrip])
313 totalHeight += NSHeight([[self tabStripView] frame]); 298 totalHeight += NSHeight([[self tabStripView] frame]);
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 devTools->SetAllowOverlappingViews(allowOverlappingViews); 1067 devTools->SetAllowOverlappingViews(allowOverlappingViews);
1083 } 1068 }
1084 1069
1085 - (void)updateInfoBarTipVisibility { 1070 - (void)updateInfoBarTipVisibility {
1086 // If there's no toolbar then hide the infobar tip. 1071 // If there's no toolbar then hide the infobar tip.
1087 [infoBarContainerController_ 1072 [infoBarContainerController_
1088 setShouldSuppressTopInfoBarTip:![self hasToolbar]]; 1073 setShouldSuppressTopInfoBarTip:![self hasToolbar]];
1089 } 1074 }
1090 1075
1091 @end // @implementation BrowserWindowController(Private) 1076 @end // @implementation BrowserWindowController(Private)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698