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/external_install_error.h" | 5 #include "chrome/browser/extensions/external_install_error.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 } | 317 } |
318 | 318 |
319 void ExternalInstallError::OnInstallPromptDone( | 319 void ExternalInstallError::OnInstallPromptDone( |
320 ExtensionInstallPrompt::Result result) { | 320 ExtensionInstallPrompt::Result result) { |
321 const Extension* extension = GetExtension(); | 321 const Extension* extension = GetExtension(); |
322 | 322 |
323 // If the error isn't removed and deleted as part of handling the user's | 323 // If the error isn't removed and deleted as part of handling the user's |
324 // response (which can happen, e.g., if an uninstall fails), be sure to remove | 324 // response (which can happen, e.g., if an uninstall fails), be sure to remove |
325 // the error directly in order to ensure it's not called twice. | 325 // the error directly in order to ensure it's not called twice. |
326 base::ThreadTaskRunnerHandle::Get()->PostTask( | 326 base::ThreadTaskRunnerHandle::Get()->PostTask( |
327 FROM_HERE, base::Bind(&ExternalInstallError::RemoveError, | 327 FROM_HERE, base::BindOnce(&ExternalInstallError::RemoveError, |
328 weak_factory_.GetWeakPtr())); | 328 weak_factory_.GetWeakPtr())); |
329 | 329 |
330 switch (result) { | 330 switch (result) { |
331 case ExtensionInstallPrompt::Result::ACCEPTED: | 331 case ExtensionInstallPrompt::Result::ACCEPTED: |
332 if (extension) { | 332 if (extension) { |
333 ExtensionSystem::Get(browser_context_) | 333 ExtensionSystem::Get(browser_context_) |
334 ->extension_service() | 334 ->extension_service() |
335 ->GrantPermissionsAndEnableExtension(extension); | 335 ->GrantPermissionsAndEnableExtension(extension); |
336 } | 336 } |
337 break; | 337 break; |
338 case ExtensionInstallPrompt::Result::USER_CANCELED: | 338 case ExtensionInstallPrompt::Result::USER_CANCELED: |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 global_error_.reset(new ExternalInstallMenuAlert(this)); | 456 global_error_.reset(new ExternalInstallMenuAlert(this)); |
457 error_service_->AddUnownedGlobalError(global_error_.get()); | 457 error_service_->AddUnownedGlobalError(global_error_.get()); |
458 } | 458 } |
459 } | 459 } |
460 | 460 |
461 void ExternalInstallError::RemoveError() { | 461 void ExternalInstallError::RemoveError() { |
462 manager_->RemoveExternalInstallError(extension_id_); | 462 manager_->RemoveExternalInstallError(extension_id_); |
463 } | 463 } |
464 | 464 |
465 } // namespace extensions | 465 } // namespace extensions |
OLD | NEW |