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

Side by Side Diff: chrome/browser/extensions/webstore_reinstaller.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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/webstore_reinstaller.h" 5 #include "chrome/browser/extensions/webstore_reinstaller.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "chrome/browser/extensions/extension_install_prompt.h" 8 #include "chrome/browser/extensions/extension_install_prompt.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 std::string* error) const { 79 std::string* error) const {
80 return true; 80 return true;
81 } 81 }
82 82
83 void WebstoreReinstaller::WebContentsDestroyed() { 83 void WebstoreReinstaller::WebContentsDestroyed() {
84 // Run the callback now, because AbortInstall() doesn't do it. 84 // Run the callback now, because AbortInstall() doesn't do it.
85 RunCallback(false, kTabClosed, webstore_install::ABORTED); 85 RunCallback(false, kTabClosed, webstore_install::ABORTED);
86 AbortInstall(); 86 AbortInstall();
87 } 87 }
88 88
89 void WebstoreReinstaller::InstallUIProceed() { 89 void WebstoreReinstaller::OnInstallPromptDone(
90 ExtensionInstallPrompt::Result result) {
91 if (result != ExtensionInstallPrompt::Result::ACCEPTED) {
92 WebstoreStandaloneInstaller::OnInstallPromptDone(result);
93 return;
94 }
95
90 if (!ExtensionSystem::Get(profile())->extension_service()->UninstallExtension( 96 if (!ExtensionSystem::Get(profile())->extension_service()->UninstallExtension(
91 id(), 97 id(),
92 UNINSTALL_REASON_REINSTALL, 98 UNINSTALL_REASON_REINSTALL,
93 base::Bind(&WebstoreReinstaller::OnDeletionDone, this), 99 base::Bind(&WebstoreReinstaller::OnDeletionDone, this),
94 NULL)) { 100 NULL)) {
95 // Run the callback now, because AbortInstall() doesn't do it. 101 // Run the callback now, because AbortInstall() doesn't do it.
96 RunCallback( 102 RunCallback(
97 false, kCouldNotUninstallExtension, webstore_install::OTHER_ERROR); 103 false, kCouldNotUninstallExtension, webstore_install::OTHER_ERROR);
98 AbortInstall(); 104 AbortInstall();
99 } 105 }
100 } 106 }
101 107
102 void WebstoreReinstaller::OnDeletionDone() { 108 void WebstoreReinstaller::OnDeletionDone() {
103 WebstoreStandaloneInstaller::InstallUIProceed(); 109 WebstoreStandaloneInstaller::OnInstallPromptDone(
110 ExtensionInstallPrompt::Result::ACCEPTED);
104 } 111 }
105 112
106 } // namespace extensions 113 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/webstore_reinstaller.h ('k') | chrome/browser/extensions/webstore_standalone_installer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698