UI Framework-1: Aura Multi-desktop
阅读原文时间:2023年07月13日阅读:1

Multi-desktop

Aura now makes it possible for the same browser process to render to multiple desktops simultaneously (e.g., Native Desktop and Metro Desktop on Windows 8).

To enable this, the Chromium codebase had to be made multi-desktop aware (i.e., chrome::HostDesktopType parameters were added in several locations).

So… a bunch of methods now take chrome::HostDesktopType, but how do you get the right HostDesktopType when you need to provide one?

There are many ways:

Most of the methods mentioned above are found in src/chrome/browser/ui/host_desktop.h.

Note: If you hardcode HOST_DESKTOP_TYPE_NATIVE it will look like it's working if you're in a single-desktop environment (which most of you are), but what it will really do is: one day someone will trigger your feature from the Ash desktop (e.g., in Windows 8 Metro) and it will open a window/tab on the native desktop (invisible to the user who is immersed in the Ash environment)…