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

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

Issue 1200833004: Apps&Extensions for Supervised Users: send permission request on outdated re-enables (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 6 months 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 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 // Extension has changed permissions significantly. Disable it. A 1667 // Extension has changed permissions significantly. Disable it. A
1668 // notification should be sent by the caller. If the extension is already 1668 // notification should be sent by the caller. If the extension is already
1669 // disabled because it was installed remotely, don't add another disable 1669 // disabled because it was installed remotely, don't add another disable
1670 // reason. 1670 // reason.
1671 if (is_privilege_increase && 1671 if (is_privilege_increase &&
1672 disable_reasons != Extension::DISABLE_REMOTE_INSTALL) { 1672 disable_reasons != Extension::DISABLE_REMOTE_INSTALL) {
1673 disable_reasons |= Extension::DISABLE_PERMISSIONS_INCREASE; 1673 disable_reasons |= Extension::DISABLE_PERMISSIONS_INCREASE;
1674 if (!extension_prefs_->DidExtensionEscalatePermissions(extension->id())) { 1674 if (!extension_prefs_->DidExtensionEscalatePermissions(extension->id())) {
1675 RecordPermissionMessagesHistogram(extension, "AutoDisable"); 1675 RecordPermissionMessagesHistogram(extension, "AutoDisable");
1676 } 1676 }
1677 extension_prefs_->SetExtensionState(extension->id(), Extension::DISABLED); 1677 extension_prefs_->SetExtensionState(extension->id(), Extension::DISABLED);
not at google - send to devlin 2015/06/24 00:25:10 I wonder if this should actually go on line 1697,
1678 1678
1679 #if defined(ENABLE_SUPERVISED_USERS) 1679 #if defined(ENABLE_SUPERVISED_USERS)
1680 // If a custodian-installed extension is disabled for a supervised user due 1680 // If a custodian-installed extension is disabled for a supervised user due
1681 // to a permissions increase, send a request to the custodian, since the 1681 // to a permissions increase, send a request to the custodian, since the
1682 // supervised user themselves can't re-enable the extension. 1682 // supervised user themselves can't re-enable the extension. If it's already
1683 if (extensions::util::IsExtensionSupervised(extension, profile_)) { 1683 // disabled due to a permissions increase though, there's no need to send
1684 // another request.
1685 if (extensions::util::IsExtensionSupervised(extension, profile_) &&
1686 !extension_prefs_->HasDisableReason(
1687 extension->id(), Extension::DISABLE_PERMISSIONS_INCREASE)) {
Marc Treib 2015/06/22 15:35:18 This is really unrelated; I just discovered the du
not at google - send to devlin 2015/06/22 21:03:10 Should the check be on line 1672-3 instead?
Marc Treib 2015/06/23 10:22:25 Hmm.. maybe? Lines 1673 and 1677 are irrelevant in
not at google - send to devlin 2015/06/24 00:25:10 Ohh right. I think at this point the prefs contain
Marc Treib 2015/06/24 11:50:57 Hm. DidExtensionEscalatePermissions checks for DIS
not at google - send to devlin 2015/06/24 20:47:38 From purely an interface perspective - without loo
Marc Treib 2015/06/29 09:52:49 Hm. Right now, if the extension doesn't come from
1684 SupervisedUserService* supervised_user_service = 1688 SupervisedUserService* supervised_user_service =
1685 SupervisedUserServiceFactory::GetForProfile(profile_); 1689 SupervisedUserServiceFactory::GetForProfile(profile_);
1686 supervised_user_service->AddExtensionUpdateRequest( 1690 supervised_user_service->AddExtensionUpdateRequest(
1687 extension->id(), *extension->version(), 1691 extension->id(), *extension->version(),
1688 base::Bind(ExtensionUpdateRequestSent, extension->id())); 1692 base::Bind(ExtensionUpdateRequestSent, extension->id()));
1689 } 1693 }
1690 #endif 1694 #endif
1691 } 1695 }
1692 if (disable_reasons != Extension::DISABLE_NONE) { 1696 if (disable_reasons != Extension::DISABLE_NONE)
1693 extension_prefs_->AddDisableReason( 1697 extension_prefs_->AddDisableReasons(extension->id(), disable_reasons);
1694 extension->id(),
1695 static_cast<Extension::DisableReason>(disable_reasons));
1696 }
1697 } 1698 }
1698 1699
1699 void ExtensionService::UpdateActiveExtensionsInCrashReporter() { 1700 void ExtensionService::UpdateActiveExtensionsInCrashReporter() {
1700 std::set<std::string> extension_ids; 1701 std::set<std::string> extension_ids;
1701 const ExtensionSet& extensions = registry_->enabled_extensions(); 1702 const ExtensionSet& extensions = registry_->enabled_extensions();
1702 for (ExtensionSet::const_iterator iter = extensions.begin(); 1703 for (ExtensionSet::const_iterator iter = extensions.begin();
1703 iter != extensions.end(); ++iter) { 1704 iter != extensions.end(); ++iter) {
1704 const Extension* extension = iter->get(); 1705 const Extension* extension = iter->get();
1705 if (!extension->is_theme() && extension->location() != Manifest::COMPONENT) 1706 if (!extension->is_theme() && extension->location() != Manifest::COMPONENT)
1706 extension_ids.insert(extension->id()); 1707 extension_ids.insert(extension->id());
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
2588 } 2589 }
2589 2590
2590 void ExtensionService::OnProfileDestructionStarted() { 2591 void ExtensionService::OnProfileDestructionStarted() {
2591 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2592 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2592 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2593 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2593 it != ids_to_unload.end(); 2594 it != ids_to_unload.end();
2594 ++it) { 2595 ++it) {
2595 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); 2596 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2596 } 2597 }
2597 } 2598 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698