Chromium Code Reviews| Index: chrome/browser/extensions/api/management/management_api.cc |
| diff --git a/chrome/browser/extensions/api/management/management_api.cc b/chrome/browser/extensions/api/management/management_api.cc |
| index 667b9e4526e5ffaedcce9c58d1c1c8d0e8764d43..e6da580dbe3c6342a2e87ec5544a205256e6f0f7 100644 |
| --- a/chrome/browser/extensions/api/management/management_api.cc |
| +++ b/chrome/browser/extensions/api/management/management_api.cc |
| @@ -407,10 +407,24 @@ bool SetEnabledFunction::RunImpl() { |
| EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(1, &enable)); |
| const Extension* extension = service()->GetExtensionById(extension_id_, true); |
| + // The extension may have been unloaded due to a crash. |
| if (!extension) { |
| - error_ = ExtensionErrorUtils::FormatErrorMessage( |
| - keys::kNoExtensionError, extension_id_); |
| - return false; |
| + UnloadedExtensionPathMap::const_iterator iter = service()-> |
| + unloaded_extension_paths().find(extension_id_); |
|
asargent_no_longer_on_chrome
2012/08/10 20:26:21
I'm not sure operating on unloaded extensions is c
mitchellwrosen
2012/08/10 23:15:27
Thanks, I didn't catch the "terminated" keyword. M
|
| + if (iter != service()->unloaded_extension_paths().end()) { |
| + if (enable) |
| + service()->ReloadExtension(extension_id_); |
| + |
| + BrowserThread::PostTask( |
| + BrowserThread::UI, |
| + FROM_HERE, |
| + base::Bind(&SetEnabledFunction::SendResponse, this, true)); |
| + return true; |
| + } else { |
| + error_ = ExtensionErrorUtils::FormatErrorMessage( |
| + keys::kNoExtensionError, extension_id_); |
| + return false; |
| + } |
| } |
| const extensions::ManagementPolicy* policy = extensions::ExtensionSystem::Get( |