fix(windows): warning icon when pinned on taskbar on windows

Two separate Windows-specific fixes:

  1. Taskbar Warning Icon Fix:
     - Issue: Yellow warning triangle on pinned taskbar icon
     - Root cause: BrowserWindowPropertyManager::UpdateWindowProperties()
       sets PKEY_AppUserModel_RelaunchCommand/RelaunchIconResource only when
       shortcut_manager is non-null AND kProfileIconVersion pref exists.
       If either condition fails, relaunch properties are empty, causing
       Windows to show a warning overlay due to app identity mismatch.
     - Fix: Added fallback else branch that uses exe path directly as icon
       source and relaunch command. Ensures relaunch properties are never
       empty for normal browser windows.

  2. VisualElements Branding Fix:
     - Issue: Start Menu tiles referenced chrome.VisualElementsManifest.xml
     - Fix: Created browseros.VisualElementsManifest.xml and updated
       BUILD.gn to reference it.
This commit is contained in:
Felarof
2025-12-02 13:48:36 -08:00
parent 16101738c4
commit 62fef26ef8
3 changed files with 63 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
index 97f843f8133c4..0acbe29f11806 100644
index 97f843f8133c4..7846f837e754d 100644
--- a/chrome/BUILD.gn
+++ b/chrome/BUILD.gn
@@ -18,6 +18,7 @@ import("//build/config/win/manifest.gni")
@@ -37,3 +37,12 @@ index 97f843f8133c4..0acbe29f11806 100644
configs += [ ":chrome_dll_symbol_order" ]
if (!is_component_build && !using_sanitizer) {
configs += [ ":chrome_dll_symbol_exports" ]
@@ -1492,7 +1499,7 @@ copy("visual_elements_resources") {
sources = [
"//chrome/app/theme/$branding_path_component/win/tiles/Logo.png",
"//chrome/app/theme/$branding_path_component/win/tiles/SmallLogo.png",
- "app/visual_elements_resources/chrome.VisualElementsManifest.xml",
+ "app/visual_elements_resources/browseros.VisualElementsManifest.xml",
]
if (is_chrome_branded) {

View File

@@ -0,0 +1,16 @@
diff --git a/chrome/app/visual_elements_resources/browseros.VisualElementsManifest.xml b/chrome/app/visual_elements_resources/browseros.VisualElementsManifest.xml
new file mode 100644
index 0000000000000..a7bb10b4056e2
--- /dev/null
+++ b/chrome/app/visual_elements_resources/browseros.VisualElementsManifest.xml
@@ -0,0 +1,10 @@
+<!-- This is only meant to be copied by chrome.exe in developer builds. -->
+<Application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <VisualElements
+ BackgroundColor="#212121"
+ ShowNameOnSquare150x150Logo="on"
+ ForegroundText="light"
+ Square150x150Logo="Logo.png"
+ Square70x70Logo="SmallLogo.png"
+ Square44x44Logo="SmallLogo.png"/>
+</Application>

View File

@@ -0,0 +1,37 @@
diff --git a/chrome/browser/ui/views/frame/browser_window_property_manager_win.cc b/chrome/browser/ui/views/frame/browser_window_property_manager_win.cc
index 1a62480aee22c..2b678add30238 100644
--- a/chrome/browser/ui/views/frame/browser_window_property_manager_win.cc
+++ b/chrome/browser/ui/views/frame/browser_window_property_manager_win.cc
@@ -6,6 +6,7 @@
#include "base/command_line.h"
#include "base/functional/bind.h"
+#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/windows_version.h"
#include "chrome/browser/browser_process.h"
@@ -17,6 +18,7 @@
#include "chrome/browser/web_applications/extensions/web_app_extension_shortcut.h"
#include "chrome/browser/web_applications/web_app_helpers.h"
#include "chrome/common/pref_names.h"
+#include "chrome/installer/util/install_util.h"
#include "components/prefs/pref_service.h"
#include "extensions/browser/extension_registry.h"
#include "ui/base/win/shell.h"
@@ -87,6 +89,16 @@ void BrowserWindowPropertyManager::UpdateWindowProperties() {
shortcut_manager->GetShortcutProperties(profile->GetPath(), &command_line,
&pinned_name, &icon_path);
command_line_string = command_line.GetCommandLineString();
+ } else if (browser->is_type_normal() || browser->is_type_popup()) {
+ // Fallback: Set basic relaunch details using the current executable.
+ // This ensures taskbar pinning works correctly even when the profile
+ // icon hasn't been created yet (e.g., in developer builds).
+ base::FilePath exe_path;
+ if (base::PathService::Get(base::FILE_EXE, &exe_path)) {
+ icon_path = exe_path;
+ command_line_string = L"\"" + exe_path.value() + L"\"";
+ pinned_name = InstallUtil::GetDisplayName();
+ }
}
ui::win::SetAppDetailsForWindow(app_id, icon_path, 0, command_line_string,
pinned_name, hwnd_);