Chromium Code Reviews| 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 ->GetDisableReasons(extension_id) & | |
|
Devlin
2017/04/06 21:01:32
nit: Prefer HasDisableReason
lazyboy
2017/04/06 22:32:56
Done.
| |
| 32 Extension::DISABLE_CORRUPTED); | |
| 30 } | 33 } |
| 31 | 34 |
| 32 WebstoreReinstaller::~WebstoreReinstaller() { | 35 WebstoreReinstaller::~WebstoreReinstaller() { |
| 33 } | 36 } |
| 34 | 37 |
| 35 void WebstoreReinstaller::BeginReinstall() { | 38 void WebstoreReinstaller::BeginReinstall() { |
| 36 WebstoreStandaloneInstaller::BeginInstall(); | 39 WebstoreStandaloneInstaller::BeginInstall(); |
| 37 } | 40 } |
| 38 | 41 |
| 39 bool WebstoreReinstaller::CheckRequestorAlive() const { | 42 bool WebstoreReinstaller::CheckRequestorAlive() const { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 AbortInstall(); | 107 AbortInstall(); |
| 105 } | 108 } |
| 106 } | 109 } |
| 107 | 110 |
| 108 void WebstoreReinstaller::OnDeletionDone() { | 111 void WebstoreReinstaller::OnDeletionDone() { |
| 109 WebstoreStandaloneInstaller::OnInstallPromptDone( | 112 WebstoreStandaloneInstaller::OnInstallPromptDone( |
| 110 ExtensionInstallPrompt::Result::ACCEPTED); | 113 ExtensionInstallPrompt::Result::ACCEPTED); |
| 111 } | 114 } |
| 112 | 115 |
| 113 } // namespace extensions | 116 } // namespace extensions |
| OLD | NEW |