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

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: test works 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.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 #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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // Place the download shelf, if any, at the bottom of the view. 271 // Place the download shelf, if any, at the bottom of the view.
273 minY = [self layoutDownloadShelfAtMinX:minX minY:minY width:width]; 272 minY = [self layoutDownloadShelfAtMinX:minX minY:minY width:width];
274 273
275 // Finally, the content area takes up all of the remaining space. 274 // Finally, the content area takes up all of the remaining space.
276 NSRect contentAreaRect = NSMakeRect(minX, minY, width, maxY - minY); 275 NSRect contentAreaRect = NSMakeRect(minX, minY, width, maxY - minY);
277 [self layoutTabContentArea:contentAreaRect]; 276 [self layoutTabContentArea:contentAreaRect];
278 277
279 // Normally, we don't need to tell the toolbar whether or not to show the 278 // Normally, we don't need to tell the toolbar whether or not to show the
280 // divider, but things break down during animation. 279 // divider, but things break down during animation.
281 [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]]; 280 [toolbarController_ setDividerOpacity:[self toolbarDividerOpacity]];
282
283 // Update the position of the active constrained window sheet. We force this
284 // here because the |sheetParentView| may not have been resized (e.g., to
285 // prevent jank during a fullscreen mode transition), but constrained window
286 // sheets also compute their position based on the bookmark bar and toolbar.
287 content::WebContents* const activeWebContents =
288 browser_->tab_strip_model()->GetActiveWebContents();
289 NSView* const sheetParentView = activeWebContents ?
290 GetSheetParentViewForWebContents(activeWebContents) : nil;
291 if (sheetParentView) {
292 [[NSNotificationCenter defaultCenter]
293 postNotificationName:NSViewFrameDidChangeNotification
294 object:sheetParentView];
295 }
296 } 281 }
297 282
298 - (CGFloat)floatingBarHeight { 283 - (CGFloat)floatingBarHeight {
299 if (![self inPresentationMode]) 284 if (![self inPresentationMode])
300 return 0; 285 return 0;
301 286
302 CGFloat totalHeight = [presentationModeController_ floatingBarVerticalOffset]; 287 CGFloat totalHeight = [presentationModeController_ floatingBarVerticalOffset];
303 288
304 if ([self hasTabStrip]) 289 if ([self hasTabStrip])
305 totalHeight += NSHeight([[self tabStripView] frame]); 290 totalHeight += NSHeight([[self tabStripView] frame]);
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 devTools->SetAllowOverlappingViews(allowOverlappingViews); 1059 devTools->SetAllowOverlappingViews(allowOverlappingViews);
1075 } 1060 }
1076 1061
1077 - (void)updateInfoBarTipVisibility { 1062 - (void)updateInfoBarTipVisibility {
1078 // If there's no toolbar then hide the infobar tip. 1063 // If there's no toolbar then hide the infobar tip.
1079 [infoBarContainerController_ 1064 [infoBarContainerController_
1080 setShouldSuppressTopInfoBarTip:![self hasToolbar]]; 1065 setShouldSuppressTopInfoBarTip:![self hasToolbar]];
1081 } 1066 }
1082 1067
1083 @end // @implementation BrowserWindowController(Private) 1068 @end // @implementation BrowserWindowController(Private)
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698