Skip to content

Commit

Permalink
Make all usages of extension uninstall dialog as 'single-use'.
Browse files Browse the repository at this point in the history
In previous refactoring uninstall dialog was made single time use. Some
code reuses uninstall dialog. This CL makes all usage as single-time
use.

BUG=737072
TEST=Manually on device on "chrome://apps" page and could remove
     multiple apps.

Change-Id: I69c952de4fc420edbcd84a5d806c32efc672fa18
Reviewed-on: https://chromium-review.googlesource.com/550256
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: Yury Khmel <khmel@google.com>
Cr-Commit-Position: refs/heads/master@{#483152}
  • Loading branch information
yurykhmel authored and Commit Bot committed Jun 28, 2017
1 parent d4aa831 commit 67c67c8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
6 changes: 2 additions & 4 deletions chrome/browser/extensions/extension_storage_monitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -576,10 +576,8 @@ void ExtensionStorageMonitor::ShowUninstallPrompt(
if (!extension)
return;

if (!uninstall_dialog_.get()) {
uninstall_dialog_.reset(ExtensionUninstallDialog::Create(
Profile::FromBrowserContext(context_), NULL, this));
}
uninstall_dialog_.reset(ExtensionUninstallDialog::Create(
Profile::FromBrowserContext(context_), NULL, this));

uninstall_extension_id_ = extension->id();
uninstall_dialog_->ConfirmUninstall(
Expand Down
19 changes: 8 additions & 11 deletions chrome/browser/ui/webui/ntp/app_launcher_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ void AppLauncherHandler::HandleUninstallApp(const base::ListValue* args) {
base::Bind(&base::DoNothing), nullptr);
CleanupAfterUninstall();
} else {
GetExtensionUninstallDialog()->ConfirmUninstall(
CreateExtensionUninstallDialog()->ConfirmUninstall(
extension, extensions::UNINSTALL_REASON_USER_INITIATED,
extensions::UNINSTALL_SOURCE_CHROME_APPS_PAGE);
}
Expand Down Expand Up @@ -856,16 +856,13 @@ void AppLauncherHandler::ExtensionEnableFlowAborted(bool user_initiated) {
}

extensions::ExtensionUninstallDialog*
AppLauncherHandler::GetExtensionUninstallDialog() {
if (!extension_uninstall_dialog_.get()) {
Browser* browser = chrome::FindBrowserWithWebContents(
web_ui()->GetWebContents());
extension_uninstall_dialog_.reset(
extensions::ExtensionUninstallDialog::Create(
extension_service_->profile(),
browser->window()->GetNativeWindow(),
this));
}
AppLauncherHandler::CreateExtensionUninstallDialog() {
Browser* browser =
chrome::FindBrowserWithWebContents(web_ui()->GetWebContents());
extension_uninstall_dialog_.reset(
extensions::ExtensionUninstallDialog::Create(
extension_service_->profile(), browser->window()->GetNativeWindow(),
this));
return extension_uninstall_dialog_.get();
}

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/webui/ntp/app_launcher_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class AppLauncherHandler

// Returns the ExtensionUninstallDialog object for this class, creating it if
// needed.
extensions::ExtensionUninstallDialog* GetExtensionUninstallDialog();
extensions::ExtensionUninstallDialog* CreateExtensionUninstallDialog();

// Continuation for installing a bookmark app after favicon lookup.
void OnFaviconForApp(std::unique_ptr<AppInstallInfo> install_info,
Expand Down

0 comments on commit 67c67c8

Please sign in to comment.