blob: 655d6ab82263e7449071b6fe3654810aecddf495 [file] [log] [blame] [view]
David Bienvenu96bd9fd2020-10-05 20:02:221# Windows Shortcut and Pinned Taskbar Icon handling
2
3When Chrome is installed on Windows, it creates a shortcut on the desktop that
4launches Chrome. It also adds the same shortcut to the start menu. These
5shortcuts do not specify a profile, so they launch Chrome with the most recently
6used profile.
7
8Windows allows users to pin applications to the taskbar. When a user
9pins an application to the taskbar, Windows looks for a desktop shortcut that
10matches the application, and if it finds one, it creates a .lnk file in the
11directory
12`<user dir>\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar.`
13If it does not find a matching desktop shortcut, it creates an 8-hex-digit
14sub-directory of
15`<user dir>\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\ImplicitAppShortcuts\`
16and puts the .lnk file in that directory. For example, 3ffff1b1b170b31e.
17
18App windows on Windows have an
19[App User Model ID (AUMI)](https://docs.microsoft.com/en-us/windows/win32/shell/appids)
20property. For Chrome windows, this is set in
21[BrowserWindowPropertyManager::UpdateWindowProperties](https://source.chromium.org/chromium/chromium/src/+/master:chrome/browser/ui/views/frame/browser_window_property_manager_win.cc?q=BrowserWindowPropertyManager::UpdateWindowProperties),
22when a window is opened. Windows desktop shortcuts have an app model property,
23and this should match the open window's AUMI. Windows groups open windows with
24the same AUMI to a taskbar icon.
25
26There are two kinds of Chrome windows with AUMI's: browser windows, and app
27windows, which include web apps, and extensions, i.e., windows opened via
28--app-id or --app.
29
30[GetAppUserModelIdForBrowser](https://source.chromium.org/chromium/chromium/src/+/master:chrome/browser/shell_integration_win.cc?q=GetAppUserModelIdForBrowser)
31constructs an AUMI for a browser window and
32[GetAppUserModelIdForApp](https://source.chromium.org/chromium/chromium/src/+/master:chrome/browser/shell_integration_win.cc?q=GetAppUserModelIdForApp)
33constructs an AUMI for an app window. Each calls
34[ShellUtil::BuildAppUserModelId](https://source.chromium.org/chromium/chromium/src/+/master:chrome/installer/util/shell_util.cc;q=ShellUtil::BuildAppUserModelId)
35to construct the AUMI out of component strings.
36
37All AUMI's start with the base app id,
38[install_static::GetBaseAppId](https://source.chromium.org/chromium/chromium/src/+/master:chrome/install_static/install_util.cc?q=install_static::GetBaseAppId).
39This varies for different Chrome channels (e.g., Canary vs. Stable) and
40different Chromium-based browsers (e.g., Chrome vs. Chromium).
41
42The AUMI for a browser app has the format:
43`<BaseAppId>.<app_name>[.<profile_name>]`.
44profile_name is only appended when it's not the default profile.
45
46The AUMI for a Chrome browser window has the format:
47`<BaseAppId>[browser_suffix][.profile_name]`.
48profile_name is only appended when it's not the default profile.
49browser_suffix is only appended to the BaseAppId if the installer
50has set the kRegisterChromeBrowserSuffix command line switch, e.g.,
51on user-level installs.
52
53Since AUMI's for browser and app windows include the profile_name, each
54profile's windows will be grouped together on the taskbar.
55
56shell_integration_win.cc has a function [GetExpectedAppId](https://source.chromium.org/chromium/chromium/src/+/master:chrome/browser/shell_integration_win.cc?q=GetExpectedAppid)
57to determine what the AUMI for a shortcut should be. It also has a function
58[MigrateTaskbarPins](https://source.chromium.org/chromium/chromium/src/+/master:chrome/browser/shell_integration_win.cc?q=MigrateTaskbarPins)
59to migrate pinned taskbar icons if the AUMI's need to change.
60
61## Multi-profile Support
62When the user has more than one profile, the shortcuts are renamed to include
63the profile name, e.g., `Chrome.lnk` becomes `<profile name> - Chrome`. The
64shortcut icons, both desktop and taskbar, are badged with their profile icon.
65This badged icon is also used in the tab preview for a Chrome window.
66
67## Diagnosing Issues
68To dump a taskbar icon's properties, run this command:
69
70`python \src\chromium\src\chrome\installer\tools\shortcut_properties.py --dump-all <user dir>\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar`
71
72This shows you the properties of all the taskbar pinned icons. If the taskbar
73icon is in a subdirectory of ImplicitApps, pass that directory to
74shortcut_properties.py.
75