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

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

Issue 2396903002: Supervised Users always need custodian approval for permission increase (Closed)
Patch Set: Remove deleted method from the header file. Created 4 years, 2 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
« no previous file with comments | « chrome/browser/extensions/extension_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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_util.h" 5 #include "chrome/browser/extensions/extension_util.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 26 matching lines...) Expand all
37 #include "ui/base/resource/resource_bundle.h" 37 #include "ui/base/resource/resource_bundle.h"
38 38
39 #if defined(OS_CHROMEOS) 39 #if defined(OS_CHROMEOS)
40 #include "chrome/browser/chromeos/file_manager/app_id.h" 40 #include "chrome/browser/chromeos/file_manager/app_id.h"
41 #endif 41 #endif
42 42
43 namespace extensions { 43 namespace extensions {
44 namespace util { 44 namespace util {
45 45
46 namespace { 46 namespace {
47
48 const char kSupervisedUserExtensionPermissionIncreaseFieldTrialName[] =
49 "SupervisedUserExtensionPermissionIncrease";
50
51 // The entry into the prefs used to flag an extension as installed by custodian. 47 // The entry into the prefs used to flag an extension as installed by custodian.
52 // It is relevant only for supervised users. 48 // It is relevant only for supervised users.
53 const char kWasInstalledByCustodianPrefName[] = "was_installed_by_custodian"; 49 const char kWasInstalledByCustodianPrefName[] = "was_installed_by_custodian";
54 50
55 // Returns true if |extension| should always be enabled in incognito mode. 51 // Returns true if |extension| should always be enabled in incognito mode.
56 bool IsWhitelistedForIncognito(const Extension* extension) { 52 bool IsWhitelistedForIncognito(const Extension* extension) {
57 const Feature* feature = FeatureProvider::GetBehaviorFeature( 53 const Feature* feature = FeatureProvider::GetBehaviorFeature(
58 BehaviorFeature::kWhitelistedForIncognito); 54 BehaviorFeature::kWhitelistedForIncognito);
59 return feature && feature->IsAvailableToExtension(extension).is_available(); 55 return feature && feature->IsAvailableToExtension(extension).is_available();
60 } 56 }
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 #else 345 #else
350 return true; 346 return true;
351 #endif 347 #endif
352 } 348 }
353 349
354 bool IsExtensionSupervised(const Extension* extension, Profile* profile) { 350 bool IsExtensionSupervised(const Extension* extension, Profile* profile) {
355 return WasInstalledByCustodian(extension->id(), profile) && 351 return WasInstalledByCustodian(extension->id(), profile) &&
356 profile->IsSupervised(); 352 profile->IsSupervised();
357 } 353 }
358 354
359 bool NeedCustodianApprovalForPermissionIncrease(const Profile* profile) {
360 if (!profile->IsSupervised())
361 return false;
362 // Query the trial group name first, to make sure it's properly initialized.
363 base::FieldTrialList::FindFullName(
364 kSupervisedUserExtensionPermissionIncreaseFieldTrialName);
365 std::string value = variations::GetVariationParamValue(
366 kSupervisedUserExtensionPermissionIncreaseFieldTrialName,
367 profile->IsChild() ? "child_account" : "legacy_supervised_user");
368 return value == "true";
369 }
370
371 } // namespace util 355 } // namespace util
372 } // namespace extensions 356 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698