Chromium Code Reviews| Index: chrome/browser/extensions/startup_helper.cc |
| diff --git a/chrome/browser/extensions/startup_helper.cc b/chrome/browser/extensions/startup_helper.cc |
| index 4074b5f7c849ac6145256c68fb78777493b9e84e..056e08081abb6522ae60649c902708adc33723ae 100644 |
| --- a/chrome/browser/extensions/startup_helper.cc |
| +++ b/chrome/browser/extensions/startup_helper.cc |
| @@ -24,6 +24,12 @@ |
| #include "extensions/common/extension.h" |
| #include "ipc/ipc_message.h" |
| +#if defined(OS_WIN) |
| +#include "apps/app_window.h" |
| +#include "apps/app_window_registry.h" |
| +#include "extensions/browser/extension_registry.h" |
| +#endif |
| + |
| using content::BrowserThread; |
| namespace { |
| @@ -32,6 +38,37 @@ void PrintPackExtensionMessage(const std::string& message) { |
| printf("%s\n", message.c_str()); |
| } |
| +// On Windows, the jumplist action for installing an ephemeral app has to use |
|
tmdiep
2014/07/18 06:37:31
Note: Windows jumplists only allow you to execute
|
| +// the --install-from-webstore command line arg to initiate an install. |
| +scoped_refptr<extensions::WebstoreStandaloneInstaller> |
| +CreateEphemeralAppInstaller( |
| + Profile* profile, |
| + const std::string& app_id, |
| + extensions::WebstoreStandaloneInstaller::Callback callback) { |
| + scoped_refptr<extensions::WebstoreStandaloneInstaller> installer; |
| + |
| +#if defined(OS_WIN) |
| + using extensions::ExtensionRegistry; |
| + ExtensionRegistry* registry = ExtensionRegistry::Get(profile); |
| + DCHECK(registry); |
| + if (!registry->GetExtensionById(app_id, ExtensionRegistry::EVERYTHING)) |
| + return installer; |
| + |
| + apps::AppWindowRegistry* app_window_registry = |
| + apps::AppWindowRegistry::Get(profile); |
| + DCHECK(app_window_registry); |
| + apps::AppWindow* app_window = |
| + app_window_registry->GetCurrentAppWindowForApp(app_id); |
| + if (!app_window) |
| + return installer; |
| + |
| + installer = new extensions::WebstoreInstallWithPrompt( |
| + app_id, profile, app_window->GetNativeWindow(), callback); |
| +#endif |
| + |
| + return installer; |
| +} |
| + |
| } // namespace |
| namespace extensions { |
| @@ -243,11 +280,12 @@ void AppInstallHelper::BeginInstall( |
| WebstoreStandaloneInstaller::Callback callback = |
| base::Bind(&AppInstallHelper::OnAppInstallComplete, |
| base::Unretained(this)); |
| - installer_ = new WebstoreStartupInstaller( |
| - id, |
| - profile, |
| - show_prompt, |
| - callback); |
| + |
| + installer_ = CreateEphemeralAppInstaller(profile, id, callback); |
| + if (!installer_.get()) { |
| + installer_ = |
| + new WebstoreStartupInstaller(id, profile, show_prompt, callback); |
| + } |
| installer_->BeginInstall(); |
| } |