chromiumembedded / cef

Chromium Embedded Framework (CEF). A simple framework for embedding Chromium-based browsers in other applications.
https://bitbucket.org/chromiumembedded/cef/
Other
3.09k stars 450 forks source link

chrome: win: Disable badge on taskbar icon with multiple profiles #3645

Closed magreenblatt closed 4 months ago

magreenblatt commented 4 months ago

Is your feature request related to a problem? Please describe. When using multiple profiles, Chrome on Windows adds a profile badge to the taskbar icon for the 2nd+ profile used in a given session. This includes default Chrome UI windows ("New window" menu option) and popups such as DevTools and PiP.

  1. Run cefclient --enable-chrome-runtime
  2. Click "Profile" icon, select "Add". Now you have 2+ profiles.
  3. Click "Profile" icon, select the other profile.
  4. Notice that the new profile window has a taskbar badge

image

Describe the solution you'd like Disable this behavior with Views-hosted parent windows, similar to #3641.

Additional context Chromium code is UpdateTaskbarDecoration.

Also related to https://superuser.com/questions/1079771/removing-the-google-chrome-profile-icon

magreenblatt commented 4 months ago

Some related crashes fixed in https://github.com/chromiumembedded/cef/commit/cc3d77eec5d8a9f75e574883b87dee39b083d0bf

magreenblatt commented 4 months ago

Call stack for drawing the taskbar decoration when selecting "New incognito window" or another profile:

>   libcef.dll!taskbar::UpdateTaskbarDecoration(Profile * profile, aura::Window * window) Line 224  C++
    libcef.dll!BrowserNonClientFrameView::OnProfileAvatarChanged(const base::FilePath & profile_path) Line 280  C++
    libcef.dll!BrowserNonClientFrameView::VisibilityChanged(views::View * starting_from, bool is_visible) Line 202  C++
    ui_views.dll!views::View::VisibilityChangedImpl(views::View * starting_from, bool is_visible) Line 3136 C++
    ui_views.dll!views::View::PropagateVisibilityNotifications(views::View * start, bool is_visible) Line 3132  C++
    ui_views.dll!views::View::PropagateVisibilityNotifications(views::View * start, bool is_visible) Line 3128  C++
    ui_views.dll!views::View::PropagateVisibilityNotifications(views::View * start, bool is_visible) Line 3128  C++
    ui_views.dll!views::Widget::OnNativeWidgetVisibilityChanged(bool visible) Line 1607 C++
    ui_views.dll!views::DesktopWindowTreeHostWin::HandleVisibilityChanged(bool visible) Line 1037   C++
    ui_views.dll!views::HWNDMessageHandler::OnWindowPosChanged(tagWINDOWPOS * window_pos) Line 3041 C++
magreenblatt commented 4 months ago

In taskbar::UpdateTaskbarDecoration we can use BrowserView::GetBrowserViewForNativeWindow(gfx::NativeWindow) to retrieve the associated BrowserView/Browser objects. We can then check for Views-hosted opener using the same logic as #3641.