Chromium Code Reviews| Index: chrome/browser/extensions/extension_service.cc |
| diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc |
| index 3708493cb3b45db6b09a9ac4b75290f1f201157b..03a2ead3b60844c16b8a7d23949721212ce92182 100644 |
| --- a/chrome/browser/extensions/extension_service.cc |
| +++ b/chrome/browser/extensions/extension_service.cc |
| @@ -90,6 +90,11 @@ |
| #include "storage/browser/fileapi/file_system_context.h" |
| #endif |
| +#if defined(ENABLE_SUPERVISED_USERS) |
|
Bernhard Bauer
2015/03/02 16:41:55
Move this before the OS_CHROMEOS block, so they ar
Marc Treib
2015/03/02 18:26:00
Done.
|
| +#include "chrome/browser/supervised_user/supervised_user_service.h" |
| +#include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| +#endif |
| + |
| using content::BrowserContext; |
| using content::BrowserThread; |
| using content::DevToolsAgentHost; |
| @@ -110,13 +115,18 @@ using extensions::SharedModuleInfo; |
| using extensions::SharedModuleService; |
| using extensions::UnloadedExtensionInfo; |
| -namespace errors = extensions::manifest_errors; |
| - |
| namespace { |
| // Wait this many seconds after an extensions becomes idle before updating it. |
| const int kUpdateIdleDelay = 5; |
| +#if defined(ENABLE_SUPERVISED_USERS) |
| +// Callback for SupervisedUserService::AddExtensionUpdateRequest. |
| +void ExtensionUpdateRequestSent(const std::string& id, bool success) { |
| + LOG_IF(WARNING, !success) << "Failed sending update request for " << id; |
| +} |
| +#endif |
| + |
| } // namespace |
| // ExtensionService. |
| @@ -1660,6 +1670,19 @@ void ExtensionService::CheckPermissionsIncrease(const Extension* extension, |
| } |
| extension_prefs_->SetExtensionState(extension->id(), Extension::DISABLED); |
| extension_prefs_->SetDidExtensionEscalatePermissions(extension, true); |
| + |
| +#if defined(ENABLE_SUPERVISED_USERS) |
| + // If a custodian-installed extension is disabled for a supervised user due |
| + // to a permissions increase, send a request to the custodian, since the |
| + // supervised user itself can't re-enable the extension. |
| + if (extensions::util::IsExtensionSupervised(extension, profile_)) { |
| + SupervisedUserService* supervised_user_service = |
| + SupervisedUserServiceFactory::GetForProfile(profile_); |
| + supervised_user_service->AddExtensionUpdateRequest( |
| + extension->id(), |
| + base::Bind(ExtensionUpdateRequestSent, extension->id())); |
| + } |
| +#endif |
| } |
| if (disable_reasons != Extension::DISABLE_NONE) { |
| extension_prefs_->AddDisableReason( |