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

Unified Diff: chrome/browser/ui/app_list/search/webstore/webstore_result.cc

Issue 339103002: Update the EphemeralAppLauncher for use by the webstorePrivate API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again Created 6 years, 6 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
« no previous file with comments | « chrome/browser/ui/app_list/search/webstore/webstore_result.h ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/search/webstore/webstore_result.cc
diff --git a/chrome/browser/ui/app_list/search/webstore/webstore_result.cc b/chrome/browser/ui/app_list/search/webstore/webstore_result.cc
index cc5e8dee9b9bb9057b065ed6ae8856a9f31f8ef1..50dea34a92b0e08943f2aa622feaf3130c7ade8b 100644
--- a/chrome/browser/ui/app_list/search/webstore/webstore_result.cc
+++ b/chrome/browser/ui/app_list/search/webstore/webstore_result.cc
@@ -7,7 +7,6 @@
#include <vector>
#include "base/bind.h"
-#include "base/command_line.h"
#include "base/memory/ref_counted.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/apps/ephemeral_app_launcher.h"
@@ -20,7 +19,6 @@
#include "chrome/browser/ui/app_list/search/webstore/webstore_installer.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/extensions/application_launch.h"
-#include "chrome/common/chrome_switches.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extension_util.h"
@@ -134,8 +132,7 @@ void WebstoreResult::UpdateActions() {
extensions::util::IsExtensionInstalledPermanently(app_id_, profile_);
if (!is_otr && !is_installed && !is_installing()) {
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableEphemeralApps)) {
+ if (EphemeralAppLauncher::IsFeatureEnabled()) {
actions.push_back(Action(
l10n_util::GetStringUTF16(IDS_WEBSTORE_RESULT_INSTALL),
l10n_util::GetStringUTF16(
@@ -186,7 +183,7 @@ void WebstoreResult::StartInstall(bool launch_ephemeral_app) {
app_id_,
profile_,
controller_->GetAppListWindow(),
- base::Bind(&WebstoreResult::InstallCallback,
+ base::Bind(&WebstoreResult::LaunchCallback,
weak_factory_.GetWeakPtr()));
installer->Start();
return;
@@ -209,10 +206,18 @@ void WebstoreResult::InstallCallback(bool success, const std::string& error) {
return;
}
- // Success handling is continued in OnExtensionInstalled.
+ // Success handling is continued in OnExtensionWillBeInstalled.
SetPercentDownloaded(100);
}
+void WebstoreResult::LaunchCallback(extensions::webstore_install::Result result,
+ const std::string& error) {
+ if (result != extensions::webstore_install::SUCCESS)
+ LOG(ERROR) << "Failed to launch app, error=" << error;
+
+ SetIsInstalling(false);
+}
+
void WebstoreResult::StartObserving() {
DCHECK(!install_tracker_ && !extension_registry_);
@@ -253,8 +258,12 @@ void WebstoreResult::OnExtensionWillBeInstalled(
return;
SetIsInstalling(false);
- UpdateActions();
- NotifyItemInstalled();
+
+ if (extensions::util::IsExtensionInstalledPermanently(extension->id(),
+ profile_)) {
+ UpdateActions();
+ NotifyItemInstalled();
+ }
}
void WebstoreResult::OnShutdown() {
« no previous file with comments | « chrome/browser/ui/app_list/search/webstore/webstore_result.h ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698