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

Side by Side Diff: ui/views/cocoa/native_widget_mac_nswindow.mm

Issue 2069103004: MacViews: Attach child windows when parent is on the screen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable test as potentialy flacky. Created 4 years, 5 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
« no previous file with comments | « ui/views/cocoa/bridged_native_widget.mm ('k') | ui/views/cocoa/views_nswindow_delegate.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/views/cocoa/native_widget_mac_nswindow.h" 5 #import "ui/views/cocoa/native_widget_mac_nswindow.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #import "ui/views/cocoa/bridged_native_widget.h" 8 #import "ui/views/cocoa/bridged_native_widget.h"
9 #import "ui/base/cocoa/user_interface_item_command_handler.h" 9 #import "ui/base/cocoa/user_interface_item_command_handler.h"
10 #import "ui/views/cocoa/views_nswindow_delegate.h" 10 #import "ui/views/cocoa/views_nswindow_delegate.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 122 }
123 123
124 // Send to the menu, after converting the event into an action message using 124 // Send to the menu, after converting the event into an action message using
125 // the content view. 125 // the content view.
126 if (type == NSKeyDown) 126 if (type == NSKeyDown)
127 [[self contentView] keyDown:event]; 127 [[self contentView] keyDown:event];
128 else 128 else
129 [[self contentView] keyUp:event]; 129 [[self contentView] keyUp:event];
130 } 130 }
131 131
132 // Override display, since this is the first opportunity Cocoa gives to detect
133 // a visibility change in some cases. For example, restoring from the dock first
134 // calls -[NSWindow display] before any NSWindowDelegate functions and before
135 // ordering the window (and without actually calling -[NSWindow deminiaturize]).
136 // By notifying the delegate that a display is about to occur, it can apply a
137 // correct visibility state, before [super display] requests a draw of the
138 // contentView. -[NSWindow isVisible] can still report NO at this point, so this
139 // gives the delegate time to apply correct visibility before the draw occurs.
140 - (void)display {
141 [[self viewsNSWindowDelegate] onWindowWillDisplay];
142 [super display];
143 }
144
145 // Override window order functions to intercept other visibility changes. This 132 // Override window order functions to intercept other visibility changes. This
146 // is needed in addition to the -[NSWindow display] override because Cocoa 133 // is needed in addition to the -[NSWindow display] override because Cocoa
147 // hardly ever calls display, and reports -[NSWindow isVisible] incorrectly 134 // hardly ever calls display, and reports -[NSWindow isVisible] incorrectly
148 // when ordering in a window for the first time. 135 // when ordering in a window for the first time.
149 - (void)orderWindow:(NSWindowOrderingMode)orderingMode 136 - (void)orderWindow:(NSWindowOrderingMode)orderingMode
150 relativeTo:(NSInteger)otherWindowNumber { 137 relativeTo:(NSInteger)otherWindowNumber {
151 [[self viewsNSWindowDelegate] onWindowOrderWillChange:orderingMode];
152 [super orderWindow:orderingMode relativeTo:otherWindowNumber]; 138 [super orderWindow:orderingMode relativeTo:otherWindowNumber];
153 [[self viewsNSWindowDelegate] onWindowOrderChanged:nil]; 139 [[self viewsNSWindowDelegate] onWindowOrderChanged:nil];
154 } 140 }
155 141
156 // NSResponder implementation. 142 // NSResponder implementation.
157 143
158 - (BOOL)performKeyEquivalent:(NSEvent*)event { 144 - (BOOL)performKeyEquivalent:(NSEvent*)event {
159 return [commandDispatcher_ performKeyEquivalent:event]; 145 return [commandDispatcher_ performKeyEquivalent:event];
160 } 146 }
161 147
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 id appController = [NSApp delegate]; 201 id appController = [NSApp delegate];
216 DCHECK([appController 202 DCHECK([appController
217 conformsToProtocol:@protocol(NSUserInterfaceValidations)]); 203 conformsToProtocol:@protocol(NSUserInterfaceValidations)]);
218 return [appController validateUserInterfaceItem:item]; 204 return [appController validateUserInterfaceItem:item];
219 } 205 }
220 206
221 return [super validateUserInterfaceItem:item]; 207 return [super validateUserInterfaceItem:item];
222 } 208 }
223 209
224 @end 210 @end
OLDNEW
« no previous file with comments | « ui/views/cocoa/bridged_native_widget.mm ('k') | ui/views/cocoa/views_nswindow_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698