Description[Mac] A more robust way to ensure panels avoid key status on window close
r127517 added a private function override to [NSApplication
_removeWindow:] to ensure that closing a window would not raise a docked
panel (i.e Hangouts). However, [NSApp _removeWindow] is just called from
[NSWindow dealloc] which can happen at unpredictable times, and might
not actually be associated with a window closing. It's uncertain whether
it's safe to call [NSWindow makeKeyWindow] at this point and the logic
seems somehow connected to the rather nasty bug in
http://crbug.com/459306
This CL implements an alternative that just starts observing
NSWindowWillCloseNotification for all windows via a leaky singleton.
It's created only after the first panel is created, to ensure the
behaviour is avoided completely when panels are not used. It also adds a
check to ensure the window forced to become key is on the active space,
which was missing.
AppShimMenuController also observes NSWindowWillCloseNotification and
never accounted for the weirdness that panels do on window close. So,
simplify the logic that sets the mainmenu back to Chrome Browser items
when closing a packaged app window. This is to ensure the observers
don't randomly fight, since they both care about the contents of [NSApp
orderedWindows]. This regresses a fix for flickering menus added in
r224710, but that's minor compared to http://crbug.com/459306
As a bonus, this crazy logic gets a test, in interactive_ui_tests.
BUG=459306
TEST=Open a browser, open the hangouts extension, dock the chat window
at the bottom of the screen, Open a second browser window. Now close
that second browser window, the first browser window should activate,
and the omnibox in that first browser should have a focus ring.
Committed: https://crrev.com/19fbc1adba623e695d07d2a2009d5fa66b1f5677
Cr-Commit-Position: refs/heads/master@{#323157}
Patch Set 1 #Patch Set 2 : Polish #Patch Set 3 : Fix [some] tests #Patch Set 4 : Nicer fix for tests #
Total comments: 3
Patch Set 5 : static #
Messages
Total messages: 18 (8 generated)
|