| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <iterator> | 10 #include <iterator> |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 id, Extension::DISABLE_PERMISSIONS_INCREASE); | 541 id, Extension::DISABLE_PERMISSIONS_INCREASE); |
| 542 const base::Version& expected_version = pending_extension_info->version(); | 542 const base::Version& expected_version = pending_extension_info->version(); |
| 543 if (has_permissions_increase || | 543 if (has_permissions_increase || |
| 544 pending_extension_info->remote_install() || | 544 pending_extension_info->remote_install() || |
| 545 !expected_version.IsValid()) { | 545 !expected_version.IsValid()) { |
| 546 installer->set_grant_permissions(false); | 546 installer->set_grant_permissions(false); |
| 547 } else { | 547 } else { |
| 548 installer->set_expected_version(expected_version, | 548 installer->set_expected_version(expected_version, |
| 549 false /* fail_install_if_unexpected */); | 549 false /* fail_install_if_unexpected */); |
| 550 } | 550 } |
| 551 creation_flags = pending_extension_info->creation_flags(); | |
| 552 if (pending_extension_info->mark_acknowledged()) | 551 if (pending_extension_info->mark_acknowledged()) |
| 553 external_install_manager_->AcknowledgeExternalExtension(id); | 552 external_install_manager_->AcknowledgeExternalExtension(id); |
| 554 } else if (extension) { | 553 } else if (extension) { |
| 555 installer->set_install_source(extension->location()); | 554 installer->set_install_source(extension->location()); |
| 556 } | 555 } |
| 557 // If the extension was installed from or has migrated to the webstore, or | 556 // If the extension was installed from or has migrated to the webstore, or |
| 558 // its auto-update URL is from the webstore, treat it as a webstore install. | 557 // its auto-update URL is from the webstore, treat it as a webstore install. |
| 559 // Note that we ignore some older extensions with blank auto-update URLs | 558 // Note that we ignore some older extensions with blank auto-update URLs |
| 560 // because we are mostly concerned with restrictions on NaCl extensions, | 559 // because we are mostly concerned with restrictions on NaCl extensions, |
| 561 // which are newer. | 560 // which are newer. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 572 // details. | 571 // details. |
| 573 if (extension && extension->from_bookmark()) | 572 if (extension && extension->from_bookmark()) |
| 574 creation_flags |= Extension::FROM_BOOKMARK; | 573 creation_flags |= Extension::FROM_BOOKMARK; |
| 575 | 574 |
| 576 if (extension && extension->was_installed_by_default()) | 575 if (extension && extension->was_installed_by_default()) |
| 577 creation_flags |= Extension::WAS_INSTALLED_BY_DEFAULT; | 576 creation_flags |= Extension::WAS_INSTALLED_BY_DEFAULT; |
| 578 | 577 |
| 579 if (extension && extension->was_installed_by_oem()) | 578 if (extension && extension->was_installed_by_oem()) |
| 580 creation_flags |= Extension::WAS_INSTALLED_BY_OEM; | 579 creation_flags |= Extension::WAS_INSTALLED_BY_OEM; |
| 581 | 580 |
| 582 if (extension && extension->was_installed_by_custodian()) | |
| 583 creation_flags |= Extension::WAS_INSTALLED_BY_CUSTODIAN; | |
| 584 | |
| 585 if (extension) | 581 if (extension) |
| 586 installer->set_do_not_sync(extension_prefs_->DoNotSync(id)); | 582 installer->set_do_not_sync(extension_prefs_->DoNotSync(id)); |
| 587 | 583 |
| 588 installer->set_creation_flags(creation_flags); | 584 installer->set_creation_flags(creation_flags); |
| 589 | 585 |
| 590 installer->set_delete_source(file_ownership_passed); | 586 installer->set_delete_source(file_ownership_passed); |
| 591 installer->set_install_cause(extension_misc::INSTALL_CAUSE_UPDATE); | 587 installer->set_install_cause(extension_misc::INSTALL_CAUSE_UPDATE); |
| 592 installer->InstallCrxFile(file); | 588 installer->InstallCrxFile(file); |
| 593 | 589 |
| 594 if (out_crx_installer) | 590 if (out_crx_installer) |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 // TODO(rdevlin.cronin): This is probably not right. We should do something | 721 // TODO(rdevlin.cronin): This is probably not right. We should do something |
| 726 // else, like include an enum IS_INTERNAL_UNINSTALL or IS_USER_UNINSTALL so | 722 // else, like include an enum IS_INTERNAL_UNINSTALL or IS_USER_UNINSTALL so |
| 727 // we don't do this. | 723 // we don't do this. |
| 728 bool external_uninstall = | 724 bool external_uninstall = |
| 729 (reason == extensions::UNINSTALL_REASON_INTERNAL_MANAGEMENT) || | 725 (reason == extensions::UNINSTALL_REASON_INTERNAL_MANAGEMENT) || |
| 730 (reason == extensions::UNINSTALL_REASON_COMPONENT_REMOVED) || | 726 (reason == extensions::UNINSTALL_REASON_COMPONENT_REMOVED) || |
| 731 (reason == extensions::UNINSTALL_REASON_REINSTALL) || | 727 (reason == extensions::UNINSTALL_REASON_REINSTALL) || |
| 732 (reason == extensions::UNINSTALL_REASON_ORPHANED_EXTERNAL_EXTENSION) || | 728 (reason == extensions::UNINSTALL_REASON_ORPHANED_EXTERNAL_EXTENSION) || |
| 733 (reason == extensions::UNINSTALL_REASON_ORPHANED_SHARED_MODULE) || | 729 (reason == extensions::UNINSTALL_REASON_ORPHANED_SHARED_MODULE) || |
| 734 (reason == extensions::UNINSTALL_REASON_SYNC && | 730 (reason == extensions::UNINSTALL_REASON_SYNC && |
| 735 extension->was_installed_by_custodian()); | 731 extensions::util::WasInstalledByCustodian(extension->id(), profile_)); |
| 736 if (!external_uninstall && | 732 if (!external_uninstall && |
| 737 (!by_policy->UserMayModifySettings(extension.get(), error) || | 733 (!by_policy->UserMayModifySettings(extension.get(), error) || |
| 738 by_policy->MustRemainInstalled(extension.get(), error))) { | 734 by_policy->MustRemainInstalled(extension.get(), error))) { |
| 739 content::NotificationService::current()->Notify( | 735 content::NotificationService::current()->Notify( |
| 740 extensions::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED, | 736 extensions::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED, |
| 741 content::Source<Profile>(profile_), | 737 content::Source<Profile>(profile_), |
| 742 content::Details<const Extension>(extension.get())); | 738 content::Details<const Extension>(extension.get())); |
| 743 return false; | 739 return false; |
| 744 } | 740 } |
| 745 | 741 |
| (...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2433 } | 2429 } |
| 2434 | 2430 |
| 2435 void ExtensionService::OnProfileDestructionStarted() { | 2431 void ExtensionService::OnProfileDestructionStarted() { |
| 2436 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2432 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
| 2437 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2433 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
| 2438 it != ids_to_unload.end(); | 2434 it != ids_to_unload.end(); |
| 2439 ++it) { | 2435 ++it) { |
| 2440 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2436 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
| 2441 } | 2437 } |
| 2442 } | 2438 } |
| OLD | NEW |