Skip to content

chrome: Add support for embedded non-Views windows #3294

Open

Description

@magreenblatt

Original report by me.


This issue involves the following functionality currently supported by the Alloy runtime:

  • Embedded non-Views windows (where the host application creates the top-level window), created with CefWindowInfo.SetAsChild.

See issue #2969 for background on the Chrome runtime.

‌

Activity

  1. magreenblatt commented on Mar 21, 2022

    @magreenblatt
    CollaboratorAuthor

    Original comment by Dominik Mayrhofer-Poldlehner (Bitbucket: dmayrhofer, GitHub: dmayrhofer).


    Would it be possible to embed CEF windows into Wayland windows with this feature?

  2. magreenblatt commented on Mar 21, 2022

    @magreenblatt
    CollaboratorAuthor

    Would it be possible to embed CEF windows into Wayland windows with this feature?

    This would likely require the Ozone implementation from issue #3263. Basically, the CEF window contents need to become a sub-surface in Wayland because embedding of “windows” on Wayland is generally not supported (based on what I can find, example here).

  3. magreenblatt commented on Mar 23, 2022

    @magreenblatt
    CollaboratorAuthor

    Issue #3289 was marked as a duplicate of this issue.

  4. magreenblatt commented on Mar 26, 2022

    @magreenblatt
    CollaboratorAuthor

    See issue #2804 for embedded Wayland support specifically.

  5. magreenblatt commented on Apr 12, 2022

    @magreenblatt
    CollaboratorAuthor

    Fix dismissal of select popups on NotifyMoveOrResizeStarted (see issue #3294)

    This impacts both Alloy and Chrome runtimes when using a native parent window.

    → <<cset 5f4bccd672c1 (bb)>>

  6. magreenblatt commented on Apr 12, 2022

    @magreenblatt
    CollaboratorAuthor

    chrome: win/linux: Add support for browser with native parent (see issue #3294)

    This change adds Chrome runtime support on Windows and Linux for creating a
    browser parented to a native window supplied by the client application.
    Expected API usage and window behavior is similar to what already exists with
    the Alloy runtime. The parent window handle should be specified by using
    CefWindowInfo::SetAsChild in combination with the CefBrowserHost::CreateBrowser
    and CefLifeSpanHandler::OnBeforePopup callbacks.

    The previously existing behavior of creating a fully-featured Chrome browser
    window when empty CefWindowInfo is used with CreateBrowser remains unchanged
    and Views is still the preferred API for creating top-level Chrome windows
    with custom styling (e.g. title bar only, frameless, etc).

    The cefclient Popup Window test with a native parent window continues to crash
    on Linux with both the Alloy and Chrome runtimes (see issue #3165).

    Also adds Chrome runtime support for CefDisplayHandler::OnCursorChange.

    To test:

    • Run cefclient --enable-chrome-runtime [--use-views] for the default (and
      previously existing) Views-based behavior.
    • Run cefclient --enable-chrome-runtime --use-native for the new native
      parent window behavior.
    • Run cefclient --enable-chrome-runtime --use-native --no-activate and the
      window will not be activated (take input focus) on launch (Windows only).
    • Run cefclient --enable-chrome-runtime [--use-views|--use-native] --mouse-cursor-change-disabled and the mouse cursor will not change on
      mouseover of DOM elements.

    → <<cset 3000bc8748d8 (bb)>>

  7. magreenblatt commented on Apr 12, 2022

    @magreenblatt
    CollaboratorAuthor

    cefclient: Add option to create default popups (see issue #3165, see issue #3294)

    This change adds a --use-default-popup command-line option to cefclient. When
    specified, popup windows will be created with default styling (e.g. without an
    application-provided native parent window).

    This change also adds some reasonable default window bounds in cases where they
    are not specified by the client.

    → <<cset 75ca552a4e88 (bb)>>

  8. magreenblatt commented on Apr 12, 2022

    @magreenblatt
    CollaboratorAuthor

    chrome: Change popup default behavior with native parent (see issue #3294)

    When using a Views-hosted browser window the client receives Views-related
    callbacks for popups and can thereby customize the Views-hosted popup behavior.
    When using an external parent window no Views-related callbacks are delivered
    and customization options are restricted to providing a new parent handle via
    OnBeforePopup. Consequently, we should default to a normal browser window in
    the external parent case instead of the very minimial Views-hosted default.

    To test (A):

    1. Run cefclient --use-default-popup --enable-chrome-runtime --use-native
    2. Select Tests > Popup Window
    3. Get a normal Chrome browser window

    To test (B):

    1. Run cefclient --use-default-popup [--enable-chrome-runtime] [--use-views]
    2. Select Tests > Popup Window
    3. Get a native or Views-hosted browser window with title bar only

    → <<cset a0a7a35fe2d1 (bb)>>

  9. magreenblatt commented on Apr 12, 2022

    @magreenblatt
    CollaboratorAuthor

    Fix dismissal of select popups on NotifyMoveOrResizeStarted (see issue #3294)

    This impacts both Alloy and Chrome runtimes when using a native parent window.

    → <<cset c3a6788f6ea1 (bb)>>

  10. magreenblatt commented on Apr 12, 2022

    @magreenblatt
    CollaboratorAuthor

    Fix dismissal of select popups on NotifyMoveOrResizeStarted (see issue #3294)

    This impacts both Alloy and Chrome runtimes when using a native parent window.

    → <<cset 579536b10703 (bb)>>

  11. magreenblatt commented on Apr 18, 2022

    @magreenblatt
    CollaboratorAuthor

    Popups are not placed correctly when running --enable-chrome-runtime --use-native --multi-threaded-message-loop.

    1. Load http://tests/dialogs
    2. Click a button (user action required for the onunload dialog)
    3. Close the window.
    4. Notice that the dialog prompt is way off to the right-hand side of the window.

    ‌

  12. magreenblatt commented on Apr 19, 2022

    @magreenblatt
    CollaboratorAuthor

    I’m not exactly sure how this will work on MacOS. The current CEF API expects CefWindowInfo to be an NSView and, with Chrome, we might need to operate on an NSWindow.

    (The following discussion is based on this overview of the Chrome Browser object model.)

    Chrome’s NativeWidgetMac uses NativeWidgetMacNSWindowHost to communicate with an NSWindow that may be hosted in a separate process (see https://crbug.com/893719). We can currently get a gfx::NativeWindow (wrapper of NSWindow*) representation via browser->browser_window()->GetNativeWindow(). However, we can’t necessarily extract an NSView from that for parenting to a client-provided NSWindow (retrieving the Chrome NSWindow’s contentView works, but reparenting that to a different NSWindow might cause undefined behavior).

    One possible approach might be using a “placeholder” NSView to locate the browser in the client’s NSWindow layout. We could then use addChildWindow to position the Chrome NSWindow on top of that “placeholder”.

  13. magreenblatt commented on Apr 19, 2022

    @magreenblatt
    CollaboratorAuthor

    chrome: Implement GetWindowHandle() for --multi-threaded-message-loop (see issue #3294)

    → <<cset c04895b22263 (bb)>>

  14. magreenblatt commented on Jun 3, 2022

    @magreenblatt
    CollaboratorAuthor

    Once we figure out the above MacOS complications we should consider moving the Alloy implementation to Views as well. We can then share the Chrome Views implementations for context menus, dialogs, etc.

  15. magreenblatt commented on Dec 20, 2022

    @magreenblatt
    CollaboratorAuthor

    Original comment by Laurenz Bihlmayer (Bitbucket: Laurenz Bihlmayer).


    Good to see that Wayland support is being worked on, at least slowly :)

    Just a quick question from a CEF noob:
    If this was resolved, would this allow applications like Spotify or Steam to finally support Wayland natively (if they update their CEF version)?
    Or do they already use Views and don’t have their own top-level window?

    And what’s the relationship of this issue and #2804? They seem to deal with pretty similiar topics.

  16. 10 remaining items

  17. magreenblatt commented on Nov 15, 2023

    @magreenblatt
    CollaboratorAuthor

    Support for DevTools popups with native parent was added in #3600.

  18. added
    native
    on Nov 15, 2023
  19. magreenblatt commented on May 9, 2024

    @magreenblatt
    CollaboratorAuthor

    This is fully supported (all platforms) with Alloy style. See #3681.

  20. added
    chrome-style
    chrome
    and removed
    chrome
    on Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Frameworkchromechrome-styleenhancementnative

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions