| Index: chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.cc
|
| diff --git a/chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.cc b/chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.cc
|
| index d791ed1937685e110e6a89ca349f3d5af5261358..8019d38ca0743e0dd35f5e11ae4f1b7eca80e7d5 100644
|
| --- a/chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.cc
|
| +++ b/chrome/browser/extensions/api/developer_private/show_permissions_dialog_helper.cc
|
| @@ -83,29 +83,30 @@ void ShowPermissionsDialogHelper::ShowPermissionsDialog(
|
| ExtensionInstallPrompt::POST_INSTALL_PERMISSIONS_PROMPT));
|
| prompt->set_retained_files(retained_file_paths);
|
| prompt->set_retained_device_messages(retained_device_messages);
|
| - prompt_->ShowDialog(this, extension, nullptr, std::move(prompt),
|
| - ExtensionInstallPrompt::GetDefaultShowDialogCallback());
|
| + // Unretained() is safe because this class manages its own lifetime and
|
| + // deletes itself in OnInstallPromptDone().
|
| + prompt_->ShowDialog(
|
| + base::Bind(&ShowPermissionsDialogHelper::OnInstallPromptDone,
|
| + base::Unretained(this)),
|
| + extension, nullptr, std::move(prompt),
|
| + ExtensionInstallPrompt::GetDefaultShowDialogCallback());
|
| }
|
|
|
| -// This is called when the user clicks "Revoke File Access."
|
| -void ShowPermissionsDialogHelper::InstallUIProceed() {
|
| - const Extension* extension =
|
| - ExtensionRegistry::Get(profile_)->GetExtensionById(
|
| - extension_id_, ExtensionRegistry::EVERYTHING);
|
| -
|
| - if (extension)
|
| - apps::SavedFilesService::Get(profile_)->ClearQueue(extension);
|
| - apps::AppLoadService::Get(profile_)
|
| - ->RestartApplicationIfRunning(extension_id_);
|
| -
|
| - on_complete_.Run();
|
| -
|
| - delete this;
|
| -}
|
| +void ShowPermissionsDialogHelper::OnInstallPromptDone(
|
| + ExtensionInstallPrompt::Result result) {
|
| + if (result == ExtensionInstallPrompt::Result::ACCEPTED) {
|
| + // This is true when the user clicks "Revoke File Access."
|
| + const Extension* extension =
|
| + ExtensionRegistry::Get(profile_)
|
| + ->GetExtensionById(extension_id_, ExtensionRegistry::EVERYTHING);
|
| +
|
| + if (extension)
|
| + apps::SavedFilesService::Get(profile_)->ClearQueue(extension);
|
| + apps::AppLoadService::Get(profile_)
|
| + ->RestartApplicationIfRunning(extension_id_);
|
| + }
|
|
|
| -void ShowPermissionsDialogHelper::InstallUIAbort(bool user_initiated) {
|
| on_complete_.Run();
|
| -
|
| delete this;
|
| }
|
|
|
|
|