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

Unified Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm

Issue 2551773002: MacViews: Exploring removal of window-modal sheets.
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm
index 92cdfa841099613b49dba258e52ccf2f979a2adb..a837c272ca85142c72570b6e299ae3e5bfc12487 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.mm
@@ -134,6 +134,13 @@ NSRect GetSheetParentBoundsForParentView(NSView* view) {
selector:@selector(onParentWindowWillClose:)
name:NSWindowWillCloseNotification
object:parentWindow_];
+
+ // Observe the parent window's size.
+ [[NSNotificationCenter defaultCenter]
+ addObserver:self
+ selector:@selector(onParentWindowSizeDidChange:)
+ name:NSWindowDidResizeNotification
+ object:parentWindow_];
}
return self;
}
@@ -169,13 +176,6 @@ NSRect GetSheetParentBoundsForParentView(NSView* view) {
return;
}
- // Observe the parent window's size.
- [[NSNotificationCenter defaultCenter]
- addObserver:self
- selector:@selector(onParentWindowSizeDidChange:)
- name:NSWindowDidResizeNotification
- object:parentWindow_];
-
// Create an invisible overlay window.
NSRect rect = [self overlayWindowFrameForParentView:parentView];
base::scoped_nsobject<NSWindow> overlayWindow(
@@ -267,10 +267,7 @@ NSRect GetSheetParentBoundsForParentView(NSView* view) {
}
- (void)onParentWindowWillClose:(NSNotification*)note {
- [[NSNotificationCenter defaultCenter]
- removeObserver:self
- name:NSWindowWillCloseNotification
- object:parentWindow_];
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
// Close all sheets.
NSArray* sheets = [NSArray arrayWithArray:sheets_];
@@ -292,6 +289,8 @@ NSRect GetSheetParentBoundsForParentView(NSView* view) {
return;
[self updateSheetPosition:activeView_];
+ if (dialogHost_)
+ dialogHost_->OnPositionRequiresUpdate();
}
- (void)updateSheetPosition:(NSView*)parentView {
@@ -350,11 +349,6 @@ NSRect GetSheetParentBoundsForParentView(NSView* view) {
if (![sheets_ containsObject:info])
return;
- [[NSNotificationCenter defaultCenter]
- removeObserver:self
- name:NSWindowDidResizeNotification
- object:parentWindow_];
-
if ([activeView_ isEqual:[info parentView]])
activeView_.reset();
« no previous file with comments | « chrome/browser/ui/cocoa/apps/native_app_window_cocoa.mm ('k') | chrome/browser/ui/cocoa/profiles/user_manager_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698