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

Side by Side Diff: chrome/browser/extensions/api/permissions/permissions_api.cc

Issue 671943003: Add update url controlled extension management settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ext-5
Patch Set: fixes addressing #3 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_management.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/extensions/api/permissions/permissions_api.h" 5 #include "chrome/browser/extensions/api/permissions/permissions_api.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/extensions/api/permissions/permissions_api_helpers.h" 9 #include "chrome/browser/extensions/api/permissions/permissions_api_helpers.h"
10 #include "chrome/browser/extensions/extension_management.h" 10 #include "chrome/browser/extensions/extension_management.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 // The requested permissions must be defined as optional in the manifest. 179 // The requested permissions must be defined as optional in the manifest.
180 if (!PermissionsParser::GetOptionalPermissions(extension()) 180 if (!PermissionsParser::GetOptionalPermissions(extension())
181 ->Contains(*requested_permissions_.get())) { 181 ->Contains(*requested_permissions_.get())) {
182 error_ = kNotInOptionalPermissionsError; 182 error_ = kNotInOptionalPermissionsError;
183 return false; 183 return false;
184 } 184 }
185 185
186 // Automatically declines api permissions requests, which are blocked by 186 // Automatically declines api permissions requests, which are blocked by
187 // enterprise policy. 187 // enterprise policy.
188 if (!ExtensionManagementFactory::GetForBrowserContext(GetProfile()) 188 if (!ExtensionManagementFactory::GetForBrowserContext(GetProfile())
189 ->IsPermissionSetAllowed(extension()->id(), 189 ->IsPermissionSetAllowed(extension(), requested_permissions_)) {
190 requested_permissions_)) {
191 error_ = kBlockedByEnterprisePolicy; 190 error_ = kBlockedByEnterprisePolicy;
192 return false; 191 return false;
193 } 192 }
194 193
195 // We don't need to prompt the user if the requested permissions are a subset 194 // We don't need to prompt the user if the requested permissions are a subset
196 // of the granted permissions set. 195 // of the granted permissions set.
197 scoped_refptr<const PermissionSet> granted = 196 scoped_refptr<const PermissionSet> granted =
198 ExtensionPrefs::Get(GetProfile()) 197 ExtensionPrefs::Get(GetProfile())
199 ->GetGrantedPermissions(extension()->id()); 198 ->GetGrantedPermissions(extension()->id());
200 if (granted.get() && granted->Contains(*requested_permissions_.get())) { 199 if (granted.get() && granted->Contains(*requested_permissions_.get())) {
(...skipping 27 matching lines...) Expand all
228 CHECK_EQ(DO_NOT_SKIP, auto_confirm_for_tests); 227 CHECK_EQ(DO_NOT_SKIP, auto_confirm_for_tests);
229 install_ui_.reset(new ExtensionInstallPrompt(GetAssociatedWebContents())); 228 install_ui_.reset(new ExtensionInstallPrompt(GetAssociatedWebContents()));
230 install_ui_->ConfirmPermissions( 229 install_ui_->ConfirmPermissions(
231 this, extension(), requested_permissions_.get()); 230 this, extension(), requested_permissions_.get());
232 } 231 }
233 232
234 return true; 233 return true;
235 } 234 }
236 235
237 } // namespace extensions 236 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_management.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698