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 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1699 AddNewOrUpdatedExtension(extension, | 1699 AddNewOrUpdatedExtension(extension, |
1700 initial_state, | 1700 initial_state, |
1701 install_flags, | 1701 install_flags, |
1702 page_ordinal, | 1702 page_ordinal, |
1703 install_parameter); | 1703 install_parameter); |
1704 } | 1704 } |
1705 } | 1705 } |
1706 | 1706 |
1707 void ExtensionService::OnExtensionManagementSettingsChanged() { | 1707 void ExtensionService::OnExtensionManagementSettingsChanged() { |
1708 error_controller_->ShowErrorIfNeeded(); | 1708 error_controller_->ShowErrorIfNeeded(); |
1709 | |
1710 // Revokes blocked permissions from active_permissions for all extensions. | |
1711 extensions::ExtensionManagement* settings = | |
1712 extensions::ExtensionManagementFactory::GetForBrowserContext(profile()); | |
1713 CHECK(settings); | |
1714 scoped_ptr<ExtensionSet> all_extensions( | |
1715 registry_->GenerateInstalledExtensionsSet()); | |
1716 for (auto extension : *all_extensions.get()) { | |
Joao da Silva
2014/10/15 14:39:26
const auto&
binjin
2014/10/16 18:13:58
Done.
| |
1717 if (!settings->IsPermissionSetAllowed( | |
1718 extension->id(), | |
1719 extension->permissions_data()->active_permissions())) { | |
1720 extensions::PermissionsUpdater(profile()).RemovePermissions( | |
Joao da Silva
2014/10/15 14:39:26
What happens in this case? If an extension is alre
binjin
2014/10/16 18:13:58
CheckManagementPolicy() will be called immediately
| |
1721 extension.get(), | |
1722 settings->GetBlockedPermissions(extension->id()).get()); | |
1723 } | |
1724 } | |
1725 | |
1709 CheckManagementPolicy(); | 1726 CheckManagementPolicy(); |
1710 } | 1727 } |
1711 | 1728 |
1712 void ExtensionService::AddNewOrUpdatedExtension( | 1729 void ExtensionService::AddNewOrUpdatedExtension( |
1713 const Extension* extension, | 1730 const Extension* extension, |
1714 Extension::State initial_state, | 1731 Extension::State initial_state, |
1715 int install_flags, | 1732 int install_flags, |
1716 const syncer::StringOrdinal& page_ordinal, | 1733 const syncer::StringOrdinal& page_ordinal, |
1717 const std::string& install_parameter) { | 1734 const std::string& install_parameter) { |
1718 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1735 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2367 } | 2384 } |
2368 | 2385 |
2369 void ExtensionService::OnProfileDestructionStarted() { | 2386 void ExtensionService::OnProfileDestructionStarted() { |
2370 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2387 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2371 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2388 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2372 it != ids_to_unload.end(); | 2389 it != ids_to_unload.end(); |
2373 ++it) { | 2390 ++it) { |
2374 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2391 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2375 } | 2392 } |
2376 } | 2393 } |
OLD | NEW |