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

Issue 1040993005: [Mac] A more robust way to ensure panels avoid key status on window close (Closed)

Created:
5 years, 8 months ago by tapted
Modified:
5 years, 8 months ago
Reviewers:
Mark Mentovai, jackhou1
CC:
chromium-reviews, jennb, jianli, Dmitry Titov, dcheng, chrome-apps-syd-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+159 lines, -26 lines) Patch
M chrome/browser/chrome_browser_application_mac.mm View 1 1 chunk +3 lines, -17 lines 0 comments Download
M chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.mm View 1 2 chunks +11 lines, -9 lines 0 comments Download
M chrome/browser/ui/cocoa/panels/panel_cocoa_browsertest.mm View 1 2 3 4 2 chunks +93 lines, -0 lines 0 comments Download
M chrome/browser/ui/cocoa/panels/panel_window_controller_cocoa.mm View 1 2 3 4 4 chunks +52 lines, -0 lines 0 comments Download

Messages

Total messages: 18 (8 generated)
tapted
Hi Mark... please take a look. This is to fix a nasty bug. Some details ...
5 years, 8 months ago (2015-03-31 11:34:10 UTC) #6
Mark Mentovai
LGTM, although it would be good to find a way to not have a flickering ...
5 years, 8 months ago (2015-03-31 13:13:31 UTC) #7
jackhou1
lgtm
5 years, 8 months ago (2015-03-31 21:50:04 UTC) #8
tapted
On 2015/03/31 13:13:31, Mark Mentovai wrote: > LGTM, although it would be good to find ...
5 years, 8 months ago (2015-03-31 23:55:30 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1040993005/140001
5 years, 8 months ago (2015-04-01 00:50:29 UTC) #13
commit-bot: I haz the power
Committed patchset #5 (id:140001)
5 years, 8 months ago (2015-04-01 00:54:08 UTC) #14
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/19fbc1adba623e695d07d2a2009d5fa66b1f5677 Cr-Commit-Position: refs/heads/master@{#323157}
5 years, 8 months ago (2015-04-01 00:54:56 UTC) #15
Mark Mentovai
There's ALLOW_UNUSED_LOCAL for this situation too.
5 years, 8 months ago (2015-04-01 02:13:59 UTC) #16
tapted
On 2015/04/01 02:13:59, Mark Mentovai wrote: > There's ALLOW_UNUSED_LOCAL for this situation too. ah, that ...
5 years, 8 months ago (2015-04-01 02:21:39 UTC) #17
Mark Mentovai
5 years, 8 months ago (2015-04-01 03:51:32 UTC) #18
Message was sent while issue was closed.
You don’t have to change what you’ve checked in if you don’t want to. I just
wanted to point out the macro for the future. It’s nice because it has better
documentary value than (void).

Powered by Google App Engine
This is Rietveld 408576698