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 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 for (ExtensionSet::const_iterator extension = terminated_set.begin(); | 930 for (ExtensionSet::const_iterator extension = terminated_set.begin(); |
931 extension != terminated_set.end(); ++extension) { | 931 extension != terminated_set.end(); ++extension) { |
932 if (management_policy->UserMayModifySettings(extension->get(), NULL)) | 932 if (management_policy->UserMayModifySettings(extension->get(), NULL)) |
933 to_disable.push_back(*extension); | 933 to_disable.push_back(*extension); |
934 } | 934 } |
935 | 935 |
936 for (extensions::ExtensionList::const_iterator extension = to_disable.begin(); | 936 for (extensions::ExtensionList::const_iterator extension = to_disable.begin(); |
937 extension != to_disable.end(); ++extension) { | 937 extension != to_disable.end(); ++extension) { |
938 if ((*extension)->was_installed_by_default() && | 938 if ((*extension)->was_installed_by_default() && |
939 extension_urls::IsWebstoreUpdateUrl( | 939 extension_urls::IsWebstoreUpdateUrl( |
940 extensions::ManifestURL::GetUpdateURL(*extension))) | 940 extensions::ManifestURL::GetUpdateURL(extension->get()))) |
941 continue; | 941 continue; |
942 const std::string& id = (*extension)->id(); | 942 const std::string& id = (*extension)->id(); |
943 if (except_ids.end() == std::find(except_ids.begin(), except_ids.end(), id)) | 943 if (except_ids.end() == std::find(except_ids.begin(), except_ids.end(), id)) |
944 DisableExtension(id, extensions::Extension::DISABLE_USER_ACTION); | 944 DisableExtension(id, extensions::Extension::DISABLE_USER_ACTION); |
945 } | 945 } |
946 } | 946 } |
947 | 947 |
948 void ExtensionService::GrantPermissionsAndEnableExtension( | 948 void ExtensionService::GrantPermissionsAndEnableExtension( |
949 const Extension* extension) { | 949 const Extension* extension) { |
950 GrantPermissions(extension); | 950 GrantPermissions(extension); |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1515 scoped_refptr<PermissionSet> granted_permissions = | 1515 scoped_refptr<PermissionSet> granted_permissions = |
1516 extension_prefs_->GetGrantedPermissions(extension->id()); | 1516 extension_prefs_->GetGrantedPermissions(extension->id()); |
1517 CHECK(granted_permissions.get()); | 1517 CHECK(granted_permissions.get()); |
1518 | 1518 |
1519 // Here, we check if an extension's privileges have increased in a manner | 1519 // Here, we check if an extension's privileges have increased in a manner |
1520 // that requires the user's approval. This could occur because the browser | 1520 // that requires the user's approval. This could occur because the browser |
1521 // upgraded and recognized additional privileges, or an extension upgrades | 1521 // upgraded and recognized additional privileges, or an extension upgrades |
1522 // to a version that requires additional privileges. | 1522 // to a version that requires additional privileges. |
1523 is_privilege_increase = | 1523 is_privilege_increase = |
1524 extensions::PermissionMessageProvider::Get()->IsPrivilegeIncrease( | 1524 extensions::PermissionMessageProvider::Get()->IsPrivilegeIncrease( |
1525 granted_permissions, | 1525 granted_permissions.get(), |
1526 extension->permissions_data()->active_permissions().get(), | 1526 extension->permissions_data()->active_permissions().get(), |
1527 extension->GetType()); | 1527 extension->GetType()); |
1528 } | 1528 } |
1529 | 1529 |
1530 if (is_extension_installed) { | 1530 if (is_extension_installed) { |
1531 // If the extension was already disabled, suppress any alerts for becoming | 1531 // If the extension was already disabled, suppress any alerts for becoming |
1532 // disabled on permissions increase. | 1532 // disabled on permissions increase. |
1533 bool previously_disabled = | 1533 bool previously_disabled = |
1534 extension_prefs_->IsExtensionDisabled(extension->id()); | 1534 extension_prefs_->IsExtensionDisabled(extension->id()); |
1535 // Legacy disabled extensions do not have a disable reason. Infer that if | 1535 // Legacy disabled extensions do not have a disable reason. Infer that if |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2359 } | 2359 } |
2360 | 2360 |
2361 void ExtensionService::OnProfileDestructionStarted() { | 2361 void ExtensionService::OnProfileDestructionStarted() { |
2362 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2362 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2363 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2363 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2364 it != ids_to_unload.end(); | 2364 it != ids_to_unload.end(); |
2365 ++it) { | 2365 ++it) { |
2366 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2366 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2367 } | 2367 } |
2368 } | 2368 } |
OLD | NEW |