Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 595363002: Add policy controlled permission block list for extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ext-fix
Patch Set: fix memory leaks Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after
1702 AddNewOrUpdatedExtension(extension, 1702 AddNewOrUpdatedExtension(extension,
1703 initial_state, 1703 initial_state,
1704 install_flags, 1704 install_flags,
1705 page_ordinal, 1705 page_ordinal,
1706 install_parameter); 1706 install_parameter);
1707 } 1707 }
1708 } 1708 }
1709 1709
1710 void ExtensionService::OnExtensionManagementSettingsChanged() { 1710 void ExtensionService::OnExtensionManagementSettingsChanged() {
1711 error_controller_->ShowErrorIfNeeded(); 1711 error_controller_->ShowErrorIfNeeded();
1712
1713 // Revokes blocked permissions from active_permissions for all extensions.
1714 extensions::ExtensionManagement* settings =
1715 extensions::ExtensionManagementFactory::GetForBrowserContext(profile());
1716 CHECK(settings);
1717 scoped_ptr<ExtensionSet> all_extensions(
1718 registry_->GenerateInstalledExtensionsSet());
1719 for (const auto& extension : *all_extensions.get()) {
1720 if (!settings->IsPermissionSetAllowed(
1721 extension->id(),
1722 extension->permissions_data()->active_permissions())) {
1723 extensions::PermissionsUpdater(profile()).RemovePermissions(
1724 extension.get(),
1725 settings->GetBlockedPermissions(extension->id()).get());
1726 }
1727 }
1728
1712 CheckManagementPolicy(); 1729 CheckManagementPolicy();
1713 } 1730 }
1714 1731
1715 void ExtensionService::AddNewOrUpdatedExtension( 1732 void ExtensionService::AddNewOrUpdatedExtension(
1716 const Extension* extension, 1733 const Extension* extension,
1717 Extension::State initial_state, 1734 Extension::State initial_state,
1718 int install_flags, 1735 int install_flags,
1719 const syncer::StringOrdinal& page_ordinal, 1736 const syncer::StringOrdinal& page_ordinal,
1720 const std::string& install_parameter) { 1737 const std::string& install_parameter) {
1721 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1738 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
2371 } 2388 }
2372 2389
2373 void ExtensionService::OnProfileDestructionStarted() { 2390 void ExtensionService::OnProfileDestructionStarted() {
2374 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2391 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2375 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2392 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2376 it != ids_to_unload.end(); 2393 it != ids_to_unload.end();
2377 ++it) { 2394 ++it) {
2378 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); 2395 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2379 } 2396 }
2380 } 2397 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_management_unittest.cc ('k') | chrome/browser/extensions/extension_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698