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

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

Issue 1534123002: [Extensions] Migrate ExtensionInstallPrompt::Delegate to be a callback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/webstore_standalone_installer.cc
diff --git a/chrome/browser/extensions/webstore_standalone_installer.cc b/chrome/browser/extensions/webstore_standalone_installer.cc
index 1942084c877ba45bf243839d1a166ba472f4c829..da7483dfe651d343e166e74b52e8532e518cdde0 100644
--- a/chrome/browser/extensions/webstore_standalone_installer.cc
+++ b/chrome/browser/extensions/webstore_standalone_installer.cc
@@ -135,9 +135,9 @@ void WebstoreStandaloneInstaller::ProceedWithInstallPrompt() {
install_prompt_ = CreateInstallPrompt();
if (install_prompt_.get()) {
ShowInstallUI();
- // Control flow finishes up in InstallUIProceed or InstallUIAbort.
+ // Control flow finishes up in OnInstallPromptDone().
} else {
- InstallUIProceed();
+ OnInstallPromptDone(ExtensionInstallPrompt::Result::ACCEPTED);
}
}
@@ -189,12 +189,21 @@ WebstoreStandaloneInstaller::CreateApproval() const {
return approval;
}
-void WebstoreStandaloneInstaller::InstallUIProceed() {
- if (!CheckRequestorAlive()) {
+void WebstoreStandaloneInstaller::OnInstallPromptDone(
+ ExtensionInstallPrompt::Result result) {
+ if (result == ExtensionInstallPrompt::Result::USER_CANCELED) {
+ CompleteInstall(webstore_install::USER_CANCELLED, kUserCancelledError);
+ return;
+ }
+
+ if (result == ExtensionInstallPrompt::Result::ABORTED ||
+ !CheckRequestorAlive()) {
CompleteInstall(webstore_install::ABORTED, std::string());
return;
}
+ DCHECK(result == ExtensionInstallPrompt::Result::ACCEPTED);
+
scoped_ptr<WebstoreInstaller::Approval> approval = CreateApproval();
ExtensionService* extension_service =
@@ -228,10 +237,6 @@ void WebstoreStandaloneInstaller::InstallUIProceed() {
installer->Start();
}
-void WebstoreStandaloneInstaller::InstallUIAbort(bool user_initiated) {
- CompleteInstall(webstore_install::USER_CANCELLED, kUserCancelledError);
-}
-
void WebstoreStandaloneInstaller::OnWebstoreRequestFailure() {
OnWebStoreDataFetcherDone();
CompleteInstall(webstore_install::WEBSTORE_REQUEST_ERROR,
@@ -404,7 +409,8 @@ void WebstoreStandaloneInstaller::ShowInstallUI() {
install_ui_ = CreateInstallUI();
install_ui_->ShowDialog(
- this, localized_extension.get(), &icon_, std::move(install_prompt_),
+ base::Bind(&WebstoreStandaloneInstaller::OnInstallPromptDone, this),
+ localized_extension.get(), &icon_, std::move(install_prompt_),
ExtensionInstallPrompt::GetDefaultShowDialogCallback());
}

Powered by Google App Engine
This is Rietveld 408576698