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 "apps/ui/views/app_window_frame_view.h" | 9 #include "apps/ui/views/app_window_frame_view.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "base/threading/sequenced_worker_pool.h" | 15 #include "base/threading/sequenced_worker_pool.h" |
16 #include "chrome/browser/apps/per_app_settings_service.h" | 16 #include "chrome/browser/apps/per_app_settings_service.h" |
17 #include "chrome/browser/apps/per_app_settings_service_factory.h" | 17 #include "chrome/browser/apps/per_app_settings_service_factory.h" |
18 #include "chrome/browser/jumplist_updater_win.h" | 18 #include "chrome/browser/jumplist_updater_win.h" |
19 #include "chrome/browser/metro_utils/metro_chrome_win.h" | 19 #include "chrome/browser/metro_utils/metro_chrome_win.h" |
20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/shell_integration.h" | 21 #include "chrome/browser/shell_integration.h" |
22 #include "chrome/browser/ui/views/apps/app_window_desktop_native_widget_aura_win
.h" | 22 #include "chrome/browser/ui/views/apps/app_window_desktop_native_widget_aura_win
.h" |
23 #include "chrome/browser/ui/views/apps/glass_app_window_frame_view_win.h" | 23 #include "chrome/browser/ui/views/apps/glass_app_window_frame_view_win.h" |
24 #include "chrome/browser/web_applications/web_app.h" | 24 #include "chrome/browser/web_applications/web_app.h" |
25 #include "chrome/browser/web_applications/web_app_win.h" | 25 #include "chrome/browser/web_applications/web_app_win.h" |
26 #include "chrome/common/chrome_icon_resources_win.h" | 26 #include "chrome/common/chrome_icon_resources_win.h" |
27 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
| 29 #include "extensions/browser/extension_util.h" |
29 #include "extensions/common/extension.h" | 30 #include "extensions/common/extension.h" |
30 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
31 #include "ui/aura/remote_window_tree_host_win.h" | 32 #include "ui/aura/remote_window_tree_host_win.h" |
32 #include "ui/base/l10n/l10n_util.h" | 33 #include "ui/base/l10n/l10n_util.h" |
33 #include "ui/base/win/shell.h" | 34 #include "ui/base/win/shell.h" |
34 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 35 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
35 #include "ui/views/win/hwnd_util.h" | 36 #include "ui/views/win/hwnd_util.h" |
36 | 37 |
37 namespace { | 38 namespace { |
38 | 39 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 // For the icon resources. | 224 // For the icon resources. |
224 base::FilePath chrome_path; | 225 base::FilePath chrome_path; |
225 if (!PathService::Get(base::FILE_EXE, &chrome_path)) | 226 if (!PathService::Get(base::FILE_EXE, &chrome_path)) |
226 return; | 227 return; |
227 | 228 |
228 JumpListUpdater jumplist_updater(app_model_id_); | 229 JumpListUpdater jumplist_updater(app_model_id_); |
229 if (!jumplist_updater.BeginUpdate()) | 230 if (!jumplist_updater.BeginUpdate()) |
230 return; | 231 return; |
231 | 232 |
232 // Add item to install ephemeral apps. | 233 // Add item to install ephemeral apps. |
233 if (extension->is_ephemeral()) { | 234 if (extensions::util::IsEphemeralApp(extension->id(), |
| 235 app_window()->browser_context())) { |
234 scoped_refptr<ShellLinkItem> link(new ShellLinkItem()); | 236 scoped_refptr<ShellLinkItem> link(new ShellLinkItem()); |
235 link->set_title(l10n_util::GetStringUTF16(IDS_APP_INSTALL_TITLE)); | 237 link->set_title(l10n_util::GetStringUTF16(IDS_APP_INSTALL_TITLE)); |
236 link->set_icon(chrome_path.value(), | 238 link->set_icon(chrome_path.value(), |
237 icon_resources::kInstallPackagedAppIndex); | 239 icon_resources::kInstallPackagedAppIndex); |
238 ShellIntegration::AppendProfileArgs( | 240 ShellIntegration::AppendProfileArgs( |
239 app_window()->browser_context()->GetPath(), link->GetCommandLine()); | 241 app_window()->browser_context()->GetPath(), link->GetCommandLine()); |
240 link->GetCommandLine()->AppendSwitchASCII(switches::kInstallFromWebstore, | 242 link->GetCommandLine()->AppendSwitchASCII(switches::kInstallFromWebstore, |
241 extension->id()); | 243 extension->id()); |
242 | 244 |
243 ShellLinkItemList items; | 245 ShellLinkItemList items; |
244 items.push_back(link); | 246 items.push_back(link); |
245 jumplist_updater.AddTasks(items); | 247 jumplist_updater.AddTasks(items); |
246 } | 248 } |
247 | 249 |
| 250 // Note that an empty jumplist must still be committed to clear all items. |
248 jumplist_updater.CommitUpdate(); | 251 jumplist_updater.CommitUpdate(); |
249 } | 252 } |
OLD | NEW |