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() { |