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

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

Issue 407483002: Show post-install UI when ephemeral apps are promoted to installed apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@install_guard
Patch Set: Check ephemeral app flag in startup_helper Created 6 years, 5 months 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
Index: chrome/browser/extensions/startup_helper.cc
diff --git a/chrome/browser/extensions/startup_helper.cc b/chrome/browser/extensions/startup_helper.cc
index 1dac8806620b548059a840b24df15a91f6d85ec2..a662982adb0d7d592bcfe0ae896b9f599eb514b3 100644
--- a/chrome/browser/extensions/startup_helper.cc
+++ b/chrome/browser/extensions/startup_helper.cc
@@ -24,6 +24,13 @@
#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"
+#include "extensions/browser/extension_util.h"
+#endif
+
using content::BrowserThread;
namespace {
@@ -32,6 +39,39 @@ void PrintPackExtensionMessage(const std::string& message) {
VLOG(1) << message;
}
+// On Windows, the jumplist action for installing an ephemeral app has to use
+// 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) ||
+ !extensions::util::IsEphemeralApp(app_id, profile)) {
+ 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 {
@@ -245,11 +285,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();
}
« no previous file with comments | « chrome/browser/extensions/extension_install_ui_util.cc ('k') | chrome/browser/extensions/webstore_install_with_prompt.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698