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

Unified Diff: chrome/browser/extensions/api/dashboard_private/dashboard_private_api.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/api/dashboard_private/dashboard_private_api.cc
diff --git a/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.cc b/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.cc
index 9c785c2cd5b8428a0a2bff96ab8aa6c5738a7392..2bb5d6d5edae51d96024ff8891aef9032e9c4c2e 100644
--- a/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.cc
+++ b/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.cc
@@ -147,9 +147,13 @@ void DashboardPrivateShowPermissionPromptForDelegatedInstallFunction::
install_prompt_.reset(new ExtensionInstallPrompt(web_contents));
install_prompt_->ShowDialog(
- this, dummy_extension_.get(), &icon, std::move(prompt),
+ base::Bind(
+ &DashboardPrivateShowPermissionPromptForDelegatedInstallFunction::
+ OnInstallPromptDone,
+ this),
+ dummy_extension_.get(), &icon, std::move(prompt),
ExtensionInstallPrompt::GetDefaultShowDialogCallback());
- // Control flow finishes up in InstallUIProceed or InstallUIAbort.
+ // Control flow finishes up in OnInstallPromptDone().
}
void DashboardPrivateShowPermissionPromptForDelegatedInstallFunction::
@@ -167,20 +171,16 @@ void DashboardPrivateShowPermissionPromptForDelegatedInstallFunction::
}
void DashboardPrivateShowPermissionPromptForDelegatedInstallFunction::
- InstallUIProceed() {
- Respond(BuildResponse(api::dashboard_private::RESULT_SUCCESS, std::string()));
-
- // Matches the AddRef in Run().
- Release();
-}
-
-void DashboardPrivateShowPermissionPromptForDelegatedInstallFunction::
- InstallUIAbort(bool user_initiated) {
- Respond(BuildResponse(api::dashboard_private::RESULT_USER_CANCELLED,
- kUserCancelledError));
+ OnInstallPromptDone(ExtensionInstallPrompt::Result result) {
+ if (result == ExtensionInstallPrompt::Result::ACCEPTED) {
+ Respond(
+ BuildResponse(api::dashboard_private::RESULT_SUCCESS, std::string()));
+ } else {
+ Respond(BuildResponse(api::dashboard_private::RESULT_USER_CANCELLED,
+ kUserCancelledError));
+ }
- // Matches the AddRef in Run().
- Release();
+ Release(); // Matches the AddRef in Run().
}
ExtensionFunction::ResponseValue

Powered by Google App Engine
This is Rietveld 408576698