Index: chrome/browser/extensions/app_shortcut_manager.cc |
diff --git a/chrome/browser/extensions/app_shortcut_manager.cc b/chrome/browser/extensions/app_shortcut_manager.cc |
index 7d1f275403cd833be7008724a10510d3192e9fde..aebef8373ccc692fec709532c725ff1fab4ec3aa 100644 |
--- a/chrome/browser/extensions/app_shortcut_manager.cc |
+++ b/chrome/browser/extensions/app_shortcut_manager.cc |
@@ -4,7 +4,9 @@ |
#include "chrome/browser/extensions/app_shortcut_manager.h" |
+#include "base/bind.h" |
#include "base/command_line.h" |
+#include "base/logging.h" |
#include "base/utf_string_conversions.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/web_applications/web_app.h" |
@@ -17,6 +19,10 @@ |
#include "skia/ext/image_operations.h" |
#include "ui/base/resource/resource_bundle.h" |
+#if defined(OS_WIN) |
+#include "chrome/browser/extensions/app_host_installer_win.h" |
+#endif |
+ |
namespace extensions { |
namespace { |
@@ -45,7 +51,8 @@ ShellIntegration::ShortcutInfo ShortcutInfoForExtensionAndProfile( |
} // namespace |
AppShortcutManager::AppShortcutManager(Profile* profile) |
- : profile_(profile), |
+ : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
erikwright (departed)
2012/11/02 20:40:59
#include "base/compiler_specific.h"
huangs
2012/11/02 22:15:33
Done.
|
+ profile_(profile), |
tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED, |
content::Source<Profile>(profile_)); |
@@ -81,8 +88,15 @@ void AppShortcutManager::Observe(int type, |
case chrome::NOTIFICATION_EXTENSION_INSTALLED: { |
const Extension* extension = content::Details<const Extension>( |
details).ptr(); |
- if (extension->is_platform_app()) |
+ if (extension->is_platform_app()) { |
+#if defined(OS_WIN) |
+ extensions::AppHostInstaller::EnsureAppHostInstalled( |
+ base::Bind(&AppShortcutManager::OnAppHostInstallationComplete, |
+ weak_factory_.GetWeakPtr(), extension)); |
+#else |
UpdateApplicationShortcuts(extension); |
+#endif |
+ } |
break; |
} |
case chrome::NOTIFICATION_EXTENSION_UNINSTALLED: { |
@@ -97,6 +111,18 @@ void AppShortcutManager::Observe(int type, |
#endif |
} |
+#if defined(OS_WIN) |
+void AppShortcutManager::OnAppHostInstallationComplete( |
+ const Extension* extension, bool app_host_install_success) { |
+ if (!app_host_install_success) { |
+ // Do not create shortcuts if App Host fails to install. |
+ LOG(ERROR) << "Application Runtime installation failed."; |
+ return; |
+ } |
+ UpdateApplicationShortcuts(extension); |
+} |
+#endif |
+ |
void AppShortcutManager::UpdateApplicationShortcuts( |
const Extension* extension) { |
shortcut_info_ = ShortcutInfoForExtensionAndProfile(extension, profile_); |