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() { |