summaryrefslogtreecommitdiffstats
path: root/ui/base/win
diff options
context:
space:
mode:
authorbenwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-28 08:59:41 +0000
committerbenwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-28 08:59:41 +0000
commita2ad3a1753ee67c96b6ae5eee9bfd214bd7d1764 (patch)
tree1510e8f8fae93168d2cbbd794b643897d71229bf /ui/base/win
parentaba36f3c3db7c2f8271cbe995ecb33ff51069e17 (diff)
downloadchromium_src-a2ad3a1753ee67c96b6ae5eee9bfd214bd7d1764.zip
chromium_src-a2ad3a1753ee67c96b6ae5eee9bfd214bd7d1764.tar.gz
chromium_src-a2ad3a1753ee67c96b6ae5eee9bfd214bd7d1764.tar.bz2
Make app launcher on Windows pinnable.
This sets the appropriate property store values so that when pinned the created shortcut will have the right icon and launch switches. A .ico has been added to the resources for this. This also removes the need to set the window icon in the previous way, so the previous resource and code has been removed. BUG=151672 Review URL: https://chromiumcodereview.appspot.com/10996042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159225 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/win')
-rw-r--r--ui/base/win/shell.cc31
-rw-r--r--ui/base/win/shell.h7
2 files changed, 33 insertions, 5 deletions
diff --git a/ui/base/win/shell.cc b/ui/base/win/shell.cc
index 32ca484..c82daf0 100644
--- a/ui/base/win/shell.cc
+++ b/ui/base/win/shell.cc
@@ -22,9 +22,11 @@ namespace win {
namespace {
-void SetAppIdAndIconForWindow(const string16& app_id,
- const string16& app_icon,
- HWND hwnd) {
+void SetAppDetailsForWindow(const string16& app_id,
+ const string16& app_icon,
+ const string16& relaunch_command,
+ const string16& relaunch_display_name,
+ HWND hwnd) {
// This functionality is only available on Win7+. It also doesn't make sense
// to do this for Chrome Metro.
if (base::win::GetVersion() < base::win::VERSION_WIN7 ||
@@ -40,6 +42,15 @@ void SetAppIdAndIconForWindow(const string16& app_id,
base::win::SetStringValueForPropertyStore(
pps, PKEY_AppUserModel_RelaunchIconResource, app_icon.c_str());
}
+ if (!relaunch_command.empty()) {
+ base::win::SetStringValueForPropertyStore(
+ pps, PKEY_AppUserModel_RelaunchCommand, relaunch_command.c_str());
+ }
+ if (!relaunch_display_name.empty()) {
+ base::win::SetStringValueForPropertyStore(
+ pps, PKEY_AppUserModel_RelaunchDisplayNameResource,
+ relaunch_display_name.c_str());
+ }
}
}
@@ -86,11 +97,21 @@ bool OpenItemViaShellNoZoneCheck(const FilePath& full_path) {
}
void SetAppIdForWindow(const string16& app_id, HWND hwnd) {
- SetAppIdAndIconForWindow(app_id, string16(), hwnd);
+ SetAppDetailsForWindow(app_id, string16(), string16(), string16(), hwnd);
}
void SetAppIconForWindow(const string16& app_icon, HWND hwnd) {
- SetAppIdAndIconForWindow(string16(), app_icon, hwnd);
+ SetAppDetailsForWindow(string16(), app_icon, string16(), string16(), hwnd);
+}
+
+void SetRelaunchDetailsForWindow(const string16& relaunch_command,
+ const string16& display_name,
+ HWND hwnd) {
+ SetAppDetailsForWindow(string16(),
+ string16(),
+ relaunch_command,
+ display_name,
+ hwnd);
}
bool IsAeroGlassEnabled() {
diff --git a/ui/base/win/shell.h b/ui/base/win/shell.h
index bf2e263..ada23de 100644
--- a/ui/base/win/shell.h
+++ b/ui/base/win/shell.h
@@ -47,6 +47,13 @@ UI_EXPORT void SetAppIdForWindow(const string16& app_id, HWND hwnd);
// Sets the application icon for the window specified.
UI_EXPORT void SetAppIconForWindow(const string16& app_icon, HWND hwnd);
+// Sets the relaunch command and relaunch display name for the window specified.
+// Windows will use this information for grouping on the taskbar, and to create
+// a shortcut if the window is pinned to the taskbar.
+UI_EXPORT void SetRelaunchDetailsForWindow(const string16& relaunch_command,
+ const string16& display_name,
+ HWND hwnd);
+
// Returns true if composition is available and turned on on the current
// platform.
UI_EXPORT bool IsAeroGlassEnabled();