| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extension_disabled_ui.h" | 5 #include "chrome/browser/extensions/extension_disabled_ui.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 void ExtensionDisabledGlobalError::BubbleViewAcceptButtonPressed( | 284 void ExtensionDisabledGlobalError::BubbleViewAcceptButtonPressed( |
| 285 Browser* browser) { | 285 Browser* browser) { |
| 286 if (extensions::util::IsExtensionSupervised(extension_, | 286 if (extensions::util::IsExtensionSupervised(extension_, |
| 287 service_->profile())) { | 287 service_->profile())) { |
| 288 return; | 288 return; |
| 289 } | 289 } |
| 290 user_response_ = REENABLE; | 290 user_response_ = REENABLE; |
| 291 // Delay extension reenabling so this bubble closes properly. | 291 // Delay extension reenabling so this bubble closes properly. |
| 292 base::ThreadTaskRunnerHandle::Get()->PostTask( | 292 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 293 FROM_HERE, | 293 FROM_HERE, |
| 294 base::Bind(&ExtensionService::GrantPermissionsAndEnableExtension, | 294 base::BindOnce(&ExtensionService::GrantPermissionsAndEnableExtension, |
| 295 service_->AsWeakPtr(), extension_)); | 295 service_->AsWeakPtr(), extension_)); |
| 296 } | 296 } |
| 297 | 297 |
| 298 void ExtensionDisabledGlobalError::BubbleViewCancelButtonPressed( | 298 void ExtensionDisabledGlobalError::BubbleViewCancelButtonPressed( |
| 299 Browser* browser) { | 299 Browser* browser) { |
| 300 // For custodian-installed extensions, this button should not exist because | 300 // For custodian-installed extensions, this button should not exist because |
| 301 // there is only an "OK" button. | 301 // there is only an "OK" button. |
| 302 // Supervised users may never remove custodian-installed extensions. | 302 // Supervised users may never remove custodian-installed extensions. |
| 303 DCHECK(!extensions::util::IsExtensionSupervised(extension_, | 303 DCHECK(!extensions::util::IsExtensionSupervised(extension_, |
| 304 service_->profile())); | 304 service_->profile())); |
| 305 uninstall_dialog_.reset(extensions::ExtensionUninstallDialog::Create( | 305 uninstall_dialog_.reset(extensions::ExtensionUninstallDialog::Create( |
| 306 service_->profile(), browser->window()->GetNativeWindow(), this)); | 306 service_->profile(), browser->window()->GetNativeWindow(), this)); |
| 307 user_response_ = UNINSTALL; | 307 user_response_ = UNINSTALL; |
| 308 // Delay showing the uninstall dialog, so that this function returns | 308 // Delay showing the uninstall dialog, so that this function returns |
| 309 // immediately, to close the bubble properly. See crbug.com/121544. | 309 // immediately, to close the bubble properly. See crbug.com/121544. |
| 310 base::ThreadTaskRunnerHandle::Get()->PostTask( | 310 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 311 FROM_HERE, | 311 FROM_HERE, |
| 312 base::Bind(&extensions::ExtensionUninstallDialog::ConfirmUninstall, | 312 base::BindOnce(&extensions::ExtensionUninstallDialog::ConfirmUninstall, |
| 313 uninstall_dialog_->AsWeakPtr(), extension_, | 313 uninstall_dialog_->AsWeakPtr(), extension_, |
| 314 extensions::UNINSTALL_REASON_EXTENSION_DISABLED, | 314 extensions::UNINSTALL_REASON_EXTENSION_DISABLED, |
| 315 extensions::UNINSTALL_SOURCE_PERMISSIONS_INCREASE)); | 315 extensions::UNINSTALL_SOURCE_PERMISSIONS_INCREASE)); |
| 316 } | 316 } |
| 317 | 317 |
| 318 bool ExtensionDisabledGlobalError::ShouldCloseOnDeactivate() const { | 318 bool ExtensionDisabledGlobalError::ShouldCloseOnDeactivate() const { |
| 319 // Since this indicates that an extension was disabled, we should definitely | 319 // Since this indicates that an extension was disabled, we should definitely |
| 320 // have the user acknowledge it, rather than having the bubble disappear when | 320 // have the user acknowledge it, rather than having the bubble disappear when |
| 321 // a new window pops up. | 321 // a new window pops up. |
| 322 return false; | 322 return false; |
| 323 } | 323 } |
| 324 | 324 |
| 325 bool ExtensionDisabledGlobalError::ShouldShowCloseButton() const { | 325 bool ExtensionDisabledGlobalError::ShouldShowCloseButton() const { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 ->LoadImageAsync(extension, | 401 ->LoadImageAsync(extension, |
| 402 image, | 402 image, |
| 403 size, | 403 size, |
| 404 base::Bind(&AddExtensionDisabledErrorWithIcon, | 404 base::Bind(&AddExtensionDisabledErrorWithIcon, |
| 405 service->AsWeakPtr(), | 405 service->AsWeakPtr(), |
| 406 extension->id(), | 406 extension->id(), |
| 407 is_remote_install)); | 407 is_remote_install)); |
| 408 } | 408 } |
| 409 | 409 |
| 410 } // namespace extensions | 410 } // namespace extensions |
| OLD | NEW |