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

Side by Side Diff: chrome/browser/ui/extensions/extension_enable_flow.cc

Issue 925563002: Supervised users: Slightly relax restrictions around extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@test_ext_install_disable
Patch Set: benwells review Created 5 years, 10 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/extensions/extension_enable_flow.h" 5 #include "chrome/browser/ui/extensions/extension_enable_flow.h"
6 6
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" 10 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 void ExtensionEnableFlow::CheckPermissionAndMaybePromptUser() { 81 void ExtensionEnableFlow::CheckPermissionAndMaybePromptUser() {
82 ExtensionService* service = 82 ExtensionService* service =
83 extensions::ExtensionSystem::Get(profile_)->extension_service(); 83 extensions::ExtensionSystem::Get(profile_)->extension_service();
84 const Extension* extension = service->GetExtensionById(extension_id_, true); 84 const Extension* extension = service->GetExtensionById(extension_id_, true);
85 if (!extension) { 85 if (!extension) {
86 delegate_->ExtensionEnableFlowAborted(false); // |delegate_| may delete us. 86 delegate_->ExtensionEnableFlowAborted(false); // |delegate_| may delete us.
87 return; 87 return;
88 } 88 }
89 89
90 // Supervised users can't re-enable custodian-installed extensions.
91 if (profile_->IsSupervised() && extension->was_installed_by_custodian()) {
benwells 2015/02/25 03:23:32 Nit: You should use your cool new function here to
Marc Treib 2015/02/25 09:48:55 Done.
92 delegate_->ExtensionEnableFlowAborted(false); // |delegate_| may delete us.
93 return;
94 }
95
90 extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_); 96 extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_);
91 if (!prefs->DidExtensionEscalatePermissions(extension_id_)) { 97 if (!prefs->DidExtensionEscalatePermissions(extension_id_)) {
92 // Enable the extension immediately if its privileges weren't escalated. 98 // Enable the extension immediately if its privileges weren't escalated.
93 // This is a no-op if the extension was previously terminated. 99 // This is a no-op if the extension was previously terminated.
94 service->EnableExtension(extension_id_); 100 service->EnableExtension(extension_id_);
95 101
96 delegate_->ExtensionEnableFlowFinished(); // |delegate_| may delete us. 102 delegate_->ExtensionEnableFlowFinished(); // |delegate_| may delete us.
97 return; 103 return;
98 } 104 }
99 105
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 168 }
163 169
164 service->GrantPermissionsAndEnableExtension(extension); 170 service->GrantPermissionsAndEnableExtension(extension);
165 delegate_->ExtensionEnableFlowFinished(); // |delegate_| may delete us. 171 delegate_->ExtensionEnableFlowFinished(); // |delegate_| may delete us.
166 } 172 }
167 173
168 void ExtensionEnableFlow::InstallUIAbort(bool user_initiated) { 174 void ExtensionEnableFlow::InstallUIAbort(bool user_initiated) {
169 delegate_->ExtensionEnableFlowAborted(user_initiated); 175 delegate_->ExtensionEnableFlowAborted(user_initiated);
170 // |delegate_| may delete us. 176 // |delegate_| may delete us.
171 } 177 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698