Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Unified Diff: chrome/browser/apps/drive/drive_app_provider.cc

Issue 405433003: Apps&Extensions for supervised users: Allow the custodian to remotely uninstall extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add test Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/apps/drive/drive_app_provider.cc
diff --git a/chrome/browser/apps/drive/drive_app_provider.cc b/chrome/browser/apps/drive/drive_app_provider.cc
index 46ac570e617a7850927b458b10ae8ae42bc4d5f9..c621ab32ee624c3a85bd3f07377d5898ca3a4652 100644
--- a/chrome/browser/apps/drive/drive_app_provider.cc
+++ b/chrome/browser/apps/drive/drive_app_provider.cc
@@ -81,10 +81,16 @@ void DriveAppProvider::UpdateMappingAndExtensionSystem(
ExtensionRegistry::Get(profile_)->GetExtensionById(
existing_chrome_app_id, ExtensionRegistry::EVERYTHING);
if (existing_app && is_existing_app_generated) {
+ // If the new app was installed by the custodian, also use custodian
+ // privileges for removing the old one.
+ extensions::UninstallReason reason =
+ new_app->was_installed_by_custodian() ?
+ extensions::UNINSTALL_REASON_SYNC_BY_CUSTODIAN :
+ extensions::UNINSTALL_REASON_SYNC;
+
extensions::ExtensionSystem::Get(profile_)
->extension_service()
- ->UninstallExtension(
- existing_chrome_app_id, extensions::UNINSTALL_REASON_SYNC, NULL);
+ ->UninstallExtension(existing_chrome_app_id, reason, NULL);
}
}
@@ -191,10 +197,13 @@ void DriveAppProvider::ProcessRemovedDriveApp(const std::string& drive_app_id) {
if (!existing_app)
return;
+ extensions::UninstallReason reason =
+ existing_app->was_installed_by_custodian() ?
+ extensions::UNINSTALL_REASON_SYNC_BY_CUSTODIAN :
+ extensions::UNINSTALL_REASON_SYNC;
extensions::ExtensionSystem::Get(profile_)
->extension_service()
- ->UninstallExtension(
- chrome_app_id, extensions::UNINSTALL_REASON_SYNC, NULL);
+ ->UninstallExtension(chrome_app_id, reason, NULL);
}
void DriveAppProvider::OnDriveAppRegistryUpdated() {
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.cc » ('j') | chrome/browser/ui/app_list/app_list_syncable_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698