OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 // managed extensions. | 694 // managed extensions. |
695 // Shared modules being uninstalled will also set |external_uninstall| to true | 695 // Shared modules being uninstalled will also set |external_uninstall| to true |
696 // so that we can guarantee users don't uninstall a shared module. | 696 // so that we can guarantee users don't uninstall a shared module. |
697 // (crbug.com/273300) | 697 // (crbug.com/273300) |
698 // TODO(rdevlin.cronin): This is probably not right. We should do something | 698 // TODO(rdevlin.cronin): This is probably not right. We should do something |
699 // else, like include an enum IS_INTERNAL_UNINSTALL or IS_USER_UNINSTALL so | 699 // else, like include an enum IS_INTERNAL_UNINSTALL or IS_USER_UNINSTALL so |
700 // we don't do this. | 700 // we don't do this. |
701 bool external_uninstall = | 701 bool external_uninstall = |
702 (reason == extensions::UNINSTALL_REASON_INTERNAL_MANAGEMENT) || | 702 (reason == extensions::UNINSTALL_REASON_INTERNAL_MANAGEMENT) || |
703 (reason == extensions::UNINSTALL_REASON_ORPHANED_EXTERNAL_EXTENSION) || | 703 (reason == extensions::UNINSTALL_REASON_ORPHANED_EXTERNAL_EXTENSION) || |
704 (reason == extensions::UNINSTALL_REASON_ORPHANED_SHARED_MODULE); | 704 (reason == extensions::UNINSTALL_REASON_ORPHANED_SHARED_MODULE) || |
| 705 (reason == extensions::UNINSTALL_REASON_SYNC && |
| 706 extension->was_installed_by_custodian()); |
705 if (!external_uninstall && | 707 if (!external_uninstall && |
706 !system_->management_policy()->UserMayModifySettings( | 708 !system_->management_policy()->UserMayModifySettings( |
707 extension.get(), error)) { | 709 extension.get(), error)) { |
708 content::NotificationService::current()->Notify( | 710 content::NotificationService::current()->Notify( |
709 chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED, | 711 chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED, |
710 content::Source<Profile>(profile_), | 712 content::Source<Profile>(profile_), |
711 content::Details<const Extension>(extension.get())); | 713 content::Details<const Extension>(extension.get())); |
712 return false; | 714 return false; |
713 } | 715 } |
714 | 716 |
(...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2343 } | 2345 } |
2344 | 2346 |
2345 void ExtensionService::OnProfileDestructionStarted() { | 2347 void ExtensionService::OnProfileDestructionStarted() { |
2346 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2348 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2347 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2349 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2348 it != ids_to_unload.end(); | 2350 it != ids_to_unload.end(); |
2349 ++it) { | 2351 ++it) { |
2350 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2352 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2351 } | 2353 } |
2352 } | 2354 } |
OLD | NEW |