New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 5 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment
link

Issue 913303: MacPWAs: Open/save/certificate dialogs appear opens in Chrome process

Reported by ccameron@chromium.org, Dec 10 Project Member

Issue description

To reproduce:
- Open Killer Marmot PWA
- Right-click save as (or open, etc, etc, etc)
- Notice that the dialog opens in a Chrome window behind the expected window

See attached video.

IIUC the relevant code is this area:
https://cs.chromium.org/chromium/src/ui/shell_dialogs/select_file_dialog_mac.h?rcl=b0b2c160fe79a296646cf11d53a084fa71d5f186&l=31

We'll need to the usual deal where the Cocoa bits are split out to be behind a separate interface.
 
save-as-behind.mov
3.2 MB View Download

Comment 1 by mgiuca@chromium.org, Dec 11

Keeping this as P1, because it opens behind the window.

If we can *focus* the opened window (but not migrate it to the shim process) then this is still a bug, but I think it drops down to a P3.

Comment 2 by mgiuca@chromium.org, Dec 11

Owner: alancutter@chromium.org
Status: Assigned (was: Untriaged)
Assigning to Alan to see if you can focus the window with this dialog.

Comment 3 by ccameron@chromium.org, Dec 13

I think that the easiest 'fix' for this is to use the dialog in Chrome, but superimpose it on top of the PWA window. See the attached video for what happens when we just add
  [owning_window setLevel:NSModalPanelWindowLevel];
to SelectFileDialogImpl::SelectFileImpl

That gets us most of the way -- a few issues
- the dialog is above other windows of other processes (not a big deal)
- Chrome retains focus after the dialog goes away
  - we'll need to make the PWA re-take focus when the dialog is dismissed

This should be acceptable for 73.
savepanel2.mov
4.7 MB View Download

Comment 4 by ccameron@chromium.org, Dec 14

Owner: ccameron@chromium.org
I have a "fix" out for this.

Comment 5 by bugdroid1@chromium.org, Dec 14

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a724b7656ccf728f169826b74f1eebe7af393053

commit a724b7656ccf728f169826b74f1eebe7af393053
Author: Christopher Cameron <ccameron@chromium.org>
Date: Fri Dec 14 19:02:42 2018

RemoteMacViews: Make certificate and file dialogs better

The certificate and file selection dialogs have not been adapted to be
able to run across processes using mojo.

At present, these dialogs appear behind their expected window, and
appear in the Chrome process. Make this situation better by making
them appear in front of their window (and, in front of everything).

Because some of these positioning decisions are made before the
true window geometry has been communicated back to the browser process,
more aggressively push geometry changes to the in-browser-process
NSWindow.

Bug: 913303
Change-Id: Ife2fbddcd758ee0b028743a916d12cf8ce0f41f3
Reviewed-on: https://chromium-review.googlesource.com/c/1378017
Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#616772}
[modify] https://crrev.com/a724b7656ccf728f169826b74f1eebe7af393053/chrome/browser/ui/views/certificate_viewer_mac_views.mm
[modify] https://crrev.com/a724b7656ccf728f169826b74f1eebe7af393053/ui/base/BUILD.gn
[add] https://crrev.com/a724b7656ccf728f169826b74f1eebe7af393053/ui/base/cocoa/remote_views_window.h
[add] https://crrev.com/a724b7656ccf728f169826b74f1eebe7af393053/ui/base/cocoa/remote_views_window.mm
[modify] https://crrev.com/a724b7656ccf728f169826b74f1eebe7af393053/ui/shell_dialogs/select_file_dialog_mac.mm
[modify] https://crrev.com/a724b7656ccf728f169826b74f1eebe7af393053/ui/views/cocoa/bridged_native_widget_host_impl.h
[modify] https://crrev.com/a724b7656ccf728f169826b74f1eebe7af393053/ui/views/cocoa/bridged_native_widget_host_impl.mm

Comment 6 by ccameron@chromium.org, Dec 17

Labels: -Pri-1 Pri-2
Summary: MacPWAs: Open/save finder dialogs appear opens in Chrome process (was: MacPWAs: Open/save finder dialogs appear in wrong process and behind window)
This is now better, but switches the app focus (inappropriately) to Chrome when the dialog closes. Might be reasonable to drop to P2 at this point.

Comment 7 by ccameron@chromium.org, Dec 20

Cc: ccameron@chromium.org
 Issue 916815  has been merged into this issue.

Comment 8 by ccameron@chromium.org, Dec 20

Summary: MacPWAs: Open/save/certificate dialogs appear opens in Chrome process (was: MacPWAs: Open/save finder dialogs appear opens in Chrome process)

Comment 9 by dominickn@chromium.org, Jan 9

This manifests in other ways, e.g.:

1. Have Gmail as a PWA
2. Attach a screenshot

When the dialog closes, focus switches to Chrome. That's actually kind of annoying. Is it worth upping the priority again to address the focus issue?

Comment 10 by ccameron@chromium.org, Jan 9

Yeah, I had plans to add something to re-focus the PWA when the "pretend" window went away, but I didn't get around to it. It should be easy to add (will definitely be done before branch, probably not FF, cause that's like-today-or-so).

Sign in to add a comment