| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |