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