| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views_win.h" | 5 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views_win.h" |
| 6 | 6 |
| 7 #include "apps/app_window.h" | 7 #include "apps/app_window.h" |
| 8 #include "apps/app_window_registry.h" | 8 #include "apps/app_window_registry.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| 30 #include "ui/base/win/shell.h" | 30 #include "ui/base/win/shell.h" |
| 31 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 31 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 32 #include "ui/views/win/hwnd_util.h" | 32 #include "ui/views/win/hwnd_util.h" |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 void CreateIconAndSetRelaunchDetails( | 36 void CreateIconAndSetRelaunchDetails( |
| 37 const base::FilePath& web_app_path, | 37 const base::FilePath& web_app_path, |
| 38 const base::FilePath& icon_file, | 38 const base::FilePath& icon_file, |
| 39 const ShellIntegration::ShortcutInfo& shortcut_info, | 39 const web_app::ShortcutInfo& shortcut_info, |
| 40 const HWND hwnd) { | 40 const HWND hwnd) { |
| 41 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 41 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| 42 | 42 |
| 43 // Set the relaunch data so "Pin this program to taskbar" has the app's | 43 // Set the relaunch data so "Pin this program to taskbar" has the app's |
| 44 // information. | 44 // information. |
| 45 CommandLine command_line = ShellIntegration::CommandLineArgsForLauncher( | 45 CommandLine command_line = ShellIntegration::CommandLineArgsForLauncher( |
| 46 shortcut_info.url, | 46 shortcut_info.url, |
| 47 shortcut_info.extension_id, | 47 shortcut_info.extension_id, |
| 48 shortcut_info.profile_path); | 48 shortcut_info.profile_path); |
| 49 | 49 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // Only switching into Ash from Native is supported. Tearing the user out of | 81 // Only switching into Ash from Native is supported. Tearing the user out of |
| 82 // Metro mode can only be done by launching a process from Metro mode itself. | 82 // Metro mode can only be done by launching a process from Metro mode itself. |
| 83 // This is done for launching apps, but not regular activations. | 83 // This is done for launching apps, but not regular activations. |
| 84 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH && | 84 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH && |
| 85 chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_NATIVE) { | 85 chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_NATIVE) { |
| 86 chrome::ActivateMetroChrome(); | 86 chrome::ActivateMetroChrome(); |
| 87 } | 87 } |
| 88 } | 88 } |
| 89 | 89 |
| 90 void ChromeNativeAppWindowViewsWin::OnShortcutInfoLoaded( | 90 void ChromeNativeAppWindowViewsWin::OnShortcutInfoLoaded( |
| 91 const ShellIntegration::ShortcutInfo& shortcut_info) { | 91 const web_app::ShortcutInfo& shortcut_info) { |
| 92 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 92 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 93 | 93 |
| 94 HWND hwnd = GetNativeAppWindowHWND(); | 94 HWND hwnd = GetNativeAppWindowHWND(); |
| 95 | 95 |
| 96 // Set window's icon to the one we're about to create/update in the web app | 96 // Set window's icon to the one we're about to create/update in the web app |
| 97 // path. The icon cache will refresh on icon creation. | 97 // path. The icon cache will refresh on icon creation. |
| 98 base::FilePath web_app_path = web_app::GetWebAppDataDirectory( | 98 base::FilePath web_app_path = web_app::GetWebAppDataDirectory( |
| 99 shortcut_info.profile_path, shortcut_info.extension_id, | 99 shortcut_info.profile_path, shortcut_info.extension_id, |
| 100 shortcut_info.url); | 100 shortcut_info.url); |
| 101 base::FilePath icon_file = web_app_path | 101 base::FilePath icon_file = web_app_path |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 link->GetCommandLine()->AppendSwitchASCII(switches::kInstallFromWebstore, | 211 link->GetCommandLine()->AppendSwitchASCII(switches::kInstallFromWebstore, |
| 212 extension->id()); | 212 extension->id()); |
| 213 | 213 |
| 214 ShellLinkItemList items; | 214 ShellLinkItemList items; |
| 215 items.push_back(link); | 215 items.push_back(link); |
| 216 jumplist_updater.AddTasks(items); | 216 jumplist_updater.AddTasks(items); |
| 217 } | 217 } |
| 218 | 218 |
| 219 jumplist_updater.CommitUpdate(); | 219 jumplist_updater.CommitUpdate(); |
| 220 } | 220 } |
| OLD | NEW |