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

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: rebase Created 5 years, 9 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/extensions/extension_util.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h" 11 #include "chrome/browser/ui/extensions/extension_enable_flow_delegate.h"
11 #include "content/public/browser/notification_details.h" 12 #include "content/public/browser/notification_details.h"
12 #include "content/public/browser/notification_source.h" 13 #include "content/public/browser/notification_source.h"
13 #include "extensions/browser/extension_prefs.h" 14 #include "extensions/browser/extension_prefs.h"
14 #include "extensions/browser/extension_registry.h" 15 #include "extensions/browser/extension_registry.h"
15 #include "extensions/browser/extension_system.h" 16 #include "extensions/browser/extension_system.h"
16 17
17 using extensions::Extension; 18 using extensions::Extension;
18 19
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 81
81 void ExtensionEnableFlow::CheckPermissionAndMaybePromptUser() { 82 void ExtensionEnableFlow::CheckPermissionAndMaybePromptUser() {
82 ExtensionService* service = 83 ExtensionService* service =
83 extensions::ExtensionSystem::Get(profile_)->extension_service(); 84 extensions::ExtensionSystem::Get(profile_)->extension_service();
84 const Extension* extension = service->GetExtensionById(extension_id_, true); 85 const Extension* extension = service->GetExtensionById(extension_id_, true);
85 if (!extension) { 86 if (!extension) {
86 delegate_->ExtensionEnableFlowAborted(false); // |delegate_| may delete us. 87 delegate_->ExtensionEnableFlowAborted(false); // |delegate_| may delete us.
87 return; 88 return;
88 } 89 }
89 90
91 // Supervised users can't re-enable custodian-installed extensions.
92 if (extensions::util::IsExtensionSupervised(extension, profile_)) {
93 delegate_->ExtensionEnableFlowAborted(false); // |delegate_| may delete us.
94 return;
95 }
96
90 extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_); 97 extensions::ExtensionPrefs* prefs = extensions::ExtensionPrefs::Get(profile_);
91 if (!prefs->DidExtensionEscalatePermissions(extension_id_)) { 98 if (!prefs->DidExtensionEscalatePermissions(extension_id_)) {
92 // Enable the extension immediately if its privileges weren't escalated. 99 // Enable the extension immediately if its privileges weren't escalated.
93 // This is a no-op if the extension was previously terminated. 100 // This is a no-op if the extension was previously terminated.
94 service->EnableExtension(extension_id_); 101 service->EnableExtension(extension_id_);
95 102
96 delegate_->ExtensionEnableFlowFinished(); // |delegate_| may delete us. 103 delegate_->ExtensionEnableFlowFinished(); // |delegate_| may delete us.
97 return; 104 return;
98 } 105 }
99 106
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 169 }
163 170
164 service->GrantPermissionsAndEnableExtension(extension); 171 service->GrantPermissionsAndEnableExtension(extension);
165 delegate_->ExtensionEnableFlowFinished(); // |delegate_| may delete us. 172 delegate_->ExtensionEnableFlowFinished(); // |delegate_| may delete us.
166 } 173 }
167 174
168 void ExtensionEnableFlow::InstallUIAbort(bool user_initiated) { 175 void ExtensionEnableFlow::InstallUIAbort(bool user_initiated) {
169 delegate_->ExtensionEnableFlowAborted(user_initiated); 176 delegate_->ExtensionEnableFlowAborted(user_initiated);
170 // |delegate_| may delete us. 177 // |delegate_| may delete us.
171 } 178 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698