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

Unified Diff: chrome/browser/extensions/app_shortcut_manager.cc

Issue 11054006: Make application shortcuts point to app_host.exe, install App Host during app installation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Also need virtual (but without OVERRIDE). Created 8 years, 1 month 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
« no previous file with comments | « chrome/browser/extensions/app_shortcut_manager.h ('k') | chrome/browser/web_applications/web_app_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0358bbc9584a519990224161068381e570489187 100644
--- a/chrome/browser/extensions/app_shortcut_manager.cc
+++ b/chrome/browser/extensions/app_shortcut_manager.cc
@@ -4,7 +4,10 @@
#include "chrome/browser/extensions/app_shortcut_manager.h"
+#include "base/bind.h"
#include "base/command_line.h"
+#include "base/compiler_specific.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 +20,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 {
@@ -46,13 +53,16 @@ ShellIntegration::ShortcutInfo ShortcutInfoForExtensionAndProfile(
AppShortcutManager::AppShortcutManager(Profile* profile)
: profile_(profile),
- tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
+ tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALLED,
content::Source<Profile>(profile_));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
content::Source<Profile>(profile_));
}
+AppShortcutManager::~AppShortcutManager() {}
+
void AppShortcutManager::OnImageLoaded(const gfx::Image& image,
const std::string& extension_id,
int index) {
@@ -81,8 +91,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 +114,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_);
« no previous file with comments | « chrome/browser/extensions/app_shortcut_manager.h ('k') | chrome/browser/web_applications/web_app_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698