| 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" |
| 11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 #include "extensions/browser/extension_system.h" | 12 #include "extensions/browser/extension_system.h" |
| 13 | 13 |
| 14 namespace extensions { | 14 namespace extensions { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 const char kCouldNotUninstallExtension[] = "Failed to uninstall the extension."; | 17 const char kCouldNotUninstallExtension[] = "Failed to uninstall the extension."; |
| 18 const char kTabClosed[] = "Tab was closed."; | 18 const char kTabClosed[] = "Tab was closed."; |
| 19 } | 19 } |
| 20 | 20 |
| 21 WebstoreReinstaller::WebstoreReinstaller( | 21 WebstoreReinstaller::WebstoreReinstaller( |
| 22 content::WebContents* web_contents, | 22 content::WebContents* web_contents, |
| 23 const std::string& extension_id, | 23 const std::string& extension_id, |
| 24 const WebstoreStandaloneInstaller::Callback& callback) | 24 const WebstoreStandaloneInstaller::Callback& callback) |
| 25 : WebstoreStandaloneInstaller( | 25 : WebstoreStandaloneInstaller( |
| 26 extension_id, | 26 extension_id, |
| 27 Profile::FromBrowserContext(web_contents->GetBrowserContext()), | 27 Profile::FromBrowserContext(web_contents->GetBrowserContext()), |
| 28 callback), | 28 callback), |
| 29 content::WebContentsObserver(web_contents) { | 29 content::WebContentsObserver(web_contents) { |
| 30 DCHECK(ExtensionPrefs::Get(web_contents->GetBrowserContext()) |
| 31 ->HasDisableReason(extension_id, Extension::DISABLE_CORRUPTED)); |
| 30 } | 32 } |
| 31 | 33 |
| 32 WebstoreReinstaller::~WebstoreReinstaller() { | 34 WebstoreReinstaller::~WebstoreReinstaller() { |
| 33 } | 35 } |
| 34 | 36 |
| 35 void WebstoreReinstaller::BeginReinstall() { | 37 void WebstoreReinstaller::BeginReinstall() { |
| 36 WebstoreStandaloneInstaller::BeginInstall(); | 38 WebstoreStandaloneInstaller::BeginInstall(); |
| 37 } | 39 } |
| 38 | 40 |
| 39 bool WebstoreReinstaller::CheckRequestorAlive() const { | 41 bool WebstoreReinstaller::CheckRequestorAlive() const { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 AbortInstall(); | 106 AbortInstall(); |
| 105 } | 107 } |
| 106 } | 108 } |
| 107 | 109 |
| 108 void WebstoreReinstaller::OnDeletionDone() { | 110 void WebstoreReinstaller::OnDeletionDone() { |
| 109 WebstoreStandaloneInstaller::OnInstallPromptDone( | 111 WebstoreStandaloneInstaller::OnInstallPromptDone( |
| 110 ExtensionInstallPrompt::Result::ACCEPTED); | 112 ExtensionInstallPrompt::Result::ACCEPTED); |
| 111 } | 113 } |
| 112 | 114 |
| 113 } // namespace extensions | 115 } // namespace extensions |
| OLD | NEW |