summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorkhannans <khannans@chromium.org>2014-12-19 08:04:25 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-19 16:05:20 +0000
commitb2025b782e266c5093e1ad40070341801877266f (patch)
tree3a91b7e54dbb74ffb6e22977f98df09989c5f853 /base
parent7c5016ccbd307a4e2a2ca140cc0739f29f288bb0 (diff)
downloadchromium_src-b2025b782e266c5093e1ad40070341801877266f.zip
chromium_src-b2025b782e266c5093e1ad40070341801877266f.tar.gz
chromium_src-b2025b782e266c5093e1ad40070341801877266f.tar.bz2
Allow managing Camera and Location for Supervised Users
BUG=440721 Review URL: https://codereview.chromium.org/789173002 Cr-Commit-Position: refs/heads/master@{#309208}
Diffstat (limited to 'base')
-rw-r--r--base/prefs/pref_service.cc10
-rw-r--r--base/prefs/pref_service.h9
-rw-r--r--base/prefs/pref_value_store.cc4
-rw-r--r--base/prefs/pref_value_store.h1
4 files changed, 24 insertions, 0 deletions
diff --git a/base/prefs/pref_service.cc b/base/prefs/pref_service.cc
index 66323a1..7a3b434 100644
--- a/base/prefs/pref_service.cc
+++ b/base/prefs/pref_service.cc
@@ -240,6 +240,12 @@ bool PrefService::IsManagedPreference(const std::string& pref_name) const {
return pref && pref->IsManaged();
}
+bool PrefService::IsPreferenceManagedByCustodian(
+ const std::string& pref_name) const {
+ const Preference* pref = FindPreference(pref_name);
+ return pref && pref->IsManagedByCustodian();
+}
+
bool PrefService::IsUserModifiablePreference(
const std::string& pref_name) const {
const Preference* pref = FindPreference(pref_name);
@@ -517,6 +523,10 @@ bool PrefService::Preference::IsManaged() const {
return pref_value_store()->PrefValueInManagedStore(name_);
}
+bool PrefService::Preference::IsManagedByCustodian() const {
+ return pref_value_store()->PrefValueInSupervisedStore(name_.c_str());
+}
+
bool PrefService::Preference::IsRecommended() const {
return pref_value_store()->PrefValueFromRecommendedStore(name_);
}
diff --git a/base/prefs/pref_service.h b/base/prefs/pref_service.h
index 734cc2b..d9b03c9 100644
--- a/base/prefs/pref_service.h
+++ b/base/prefs/pref_service.h
@@ -88,6 +88,11 @@ class BASE_PREFS_EXPORT PrefService : public base::NonThreadSafe {
// whether the pref is actually being controlled by the policy setting.
bool IsManaged() const;
+ // Returns true if the Preference is controlled by the custodian of the
+ // supervised user. Since a supervised user is not expected to have an admin
+ // policy, this is the controlling pref if set.
+ bool IsManagedByCustodian() const;
+
// Returns true if the Preference is recommended, i.e. set by an admin
// policy but the user is allowed to change it.
bool IsRecommended() const;
@@ -158,6 +163,10 @@ class BASE_PREFS_EXPORT PrefService : public base::NonThreadSafe {
// and is managed.
bool IsManagedPreference(const std::string& pref_name) const;
+ // Returns true if the preference for the given preference name is available
+ // and is controlled by the parent/guardian of the child Account.
+ bool IsPreferenceManagedByCustodian(const std::string& pref_name) const;
+
// Returns |true| if a preference with the given name is available and its
// value can be changed by the user.
bool IsUserModifiablePreference(const std::string& pref_name) const;
diff --git a/base/prefs/pref_value_store.cc b/base/prefs/pref_value_store.cc
index 4b7aab9..1a0ec08 100644
--- a/base/prefs/pref_value_store.cc
+++ b/base/prefs/pref_value_store.cc
@@ -138,6 +138,10 @@ bool PrefValueStore::PrefValueInManagedStore(const std::string& name) const {
return PrefValueInStore(name, MANAGED_STORE);
}
+bool PrefValueStore::PrefValueInSupervisedStore(const std::string& name) const {
+ return PrefValueInStore(name, SUPERVISED_USER_STORE);
+}
+
bool PrefValueStore::PrefValueInExtensionStore(const std::string& name) const {
return PrefValueInStore(name, EXTENSION_STORE);
}
diff --git a/base/prefs/pref_value_store.h b/base/prefs/pref_value_store.h
index 33203bd..5160115 100644
--- a/base/prefs/pref_value_store.h
+++ b/base/prefs/pref_value_store.h
@@ -95,6 +95,7 @@ class BASE_PREFS_EXPORT PrefValueStore {
// indicated pref store, even if that value is currently being overridden by
// a higher-priority source.
bool PrefValueInManagedStore(const std::string& name) const;
+ bool PrefValueInSupervisedStore(const std::string& name) const;
bool PrefValueInExtensionStore(const std::string& name) const;
bool PrefValueInUserStore(const std::string& name) const;