Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1172)

Unified Diff: chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc

Issue 258243002: Support "Pin to taskbar" for hosted app windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc
diff --git a/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc b/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc
index d545ac345c858964d749fbd705e353f520d7da58..533e8664864bfc64d8363e34f42b09f9a0fd7976 100644
--- a/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc
+++ b/chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc
@@ -39,42 +39,6 @@
#include "chrome/browser/ui/ash/ash_util.h"
#endif
-namespace {
-
-void CreateIconAndSetRelaunchDetails(
- const base::FilePath& web_app_path,
- const base::FilePath& icon_file,
- const ShellIntegration::ShortcutInfo& shortcut_info,
- const HWND hwnd) {
- DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
-
- // Set the relaunch data so "Pin this program to taskbar" has the app's
- // information.
- CommandLine command_line = ShellIntegration::CommandLineArgsForLauncher(
- shortcut_info.url,
- shortcut_info.extension_id,
- shortcut_info.profile_path);
-
- base::FilePath chrome_exe;
- if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
- NOTREACHED();
- return;
- }
- command_line.SetProgram(chrome_exe);
- ui::win::SetRelaunchDetailsForWindow(command_line.GetCommandLineString(),
- shortcut_info.title, hwnd);
-
- if (!base::PathExists(web_app_path) &&
- !base::CreateDirectory(web_app_path)) {
- return;
- }
-
- ui::win::SetAppIconForWindow(icon_file.value(), hwnd);
- web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info.favicon);
-}
-
-} // namespace
-
ChromeNativeAppWindowViewsWin::ChromeNativeAppWindowViewsWin()
: weak_ptr_factory_(this), glass_frame_view_(NULL) {}
@@ -95,27 +59,6 @@ void ChromeNativeAppWindowViewsWin::ActivateParentDesktopIfNecessary() {
}
}
-void ChromeNativeAppWindowViewsWin::OnShortcutInfoLoaded(
- const ShellIntegration::ShortcutInfo& shortcut_info) {
- DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
-
- HWND hwnd = GetNativeAppWindowHWND();
-
- // Set window's icon to the one we're about to create/update in the web app
- // path. The icon cache will refresh on icon creation.
- base::FilePath web_app_path = web_app::GetWebAppDataDirectory(
- shortcut_info.profile_path, shortcut_info.extension_id,
- shortcut_info.url);
- base::FilePath icon_file = web_app_path
- .Append(web_app::internals::GetSanitizedFileName(shortcut_info.title))
- .ReplaceExtension(FILE_PATH_LITERAL(".ico"));
-
- content::BrowserThread::PostBlockingPoolTask(
- FROM_HERE,
- base::Bind(&CreateIconAndSetRelaunchDetails,
- web_app_path, icon_file, shortcut_info, hwnd));
-}
-
HWND ChromeNativeAppWindowViewsWin::GetNativeAppWindowHWND() const {
return views::HWNDForWidget(widget()->GetTopLevelWidget());
}
@@ -167,11 +110,7 @@ void ChromeNativeAppWindowViewsWin::InitializeDefaultWindow(
profile->GetPath());
ui::win::SetAppIdForWindow(app_model_id_, hwnd);
- web_app::UpdateShortcutInfoAndIconForApp(
- extension,
- profile,
- base::Bind(&ChromeNativeAppWindowViewsWin::OnShortcutInfoLoaded,
- weak_ptr_factory_.GetWeakPtr()));
+ web_app::UpdateRelaunchDetailsForApp(profile, extension, hwnd);
UpdateShelfMenu();
}

Powered by Google App Engine
This is Rietveld 408576698