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

Unified Diff: chrome/browser/android/preferences/pref_service_bridge.cc

Issue 902833003: Add a HostContentSettingsMap layer for Supervised Users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/preferences/pref_service_bridge.cc
diff --git a/chrome/browser/android/preferences/pref_service_bridge.cc b/chrome/browser/android/preferences/pref_service_bridge.cc
index 503815f61168b7777e535e8928935a6067c3d482..f7e28609a3815cb973b2a21f1d036074ae1ce199 100644
--- a/chrome/browser/android/preferences/pref_service_bridge.cc
+++ b/chrome/browser/android/preferences/pref_service_bridge.cc
@@ -104,6 +104,17 @@ bool IsContentSettingManaged(ContentSettingsType content_settings_type) {
return provider == HostContentSettingsMap::POLICY_PROVIDER;
}
+bool IsContentSettingManagedByCustodian(
+ ContentSettingsType content_settings_type) {
+ std::string source;
+ HostContentSettingsMap* content_settings =
+ GetOriginalProfile()->GetHostContentSettingsMap();
+ content_settings->GetDefaultContentSetting(content_settings_type, &source);
+ HostContentSettingsMap::ProviderType provider =
+ content_settings->GetProviderTypeFromSource(source);
+ return provider == HostContentSettingsMap::SUPERVISED_PROVIDER;
+}
+
bool IsContentSettingUserModifiable(ContentSettingsType content_settings_type) {
std::string source;
HostContentSettingsMap* content_settings =
@@ -230,8 +241,7 @@ static jboolean GetAllowLocationUserModifiable(JNIEnv* env, jobject obj) {
}
static jboolean GetAllowLocationManagedByCustodian(JNIEnv* env, jobject obj) {
- return GetPrefService()->IsPreferenceManagedByCustodian(
- prefs::kGeolocationEnabled);
+ return IsContentSettingManagedByCustodian(CONTENT_SETTINGS_TYPE_GEOLOCATION);
}
static jboolean GetResolveNavigationErrorEnabled(JNIEnv* env, jobject obj) {
@@ -477,12 +487,7 @@ static jboolean GetCameraMicUserModifiable(JNIEnv* env, jobject obj) {
}
static jboolean GetCameraMicManagedByCustodian(JNIEnv* env, jobject obj) {
- PrefService* prefs = GetPrefService();
- if (prefs->IsPreferenceManagedByCustodian(prefs::kVideoCaptureAllowed))
- return true;
- if (prefs->IsPreferenceManagedByCustodian(prefs::kAudioCaptureAllowed))
- return true;
- return false;
+ return IsContentSettingManagedByCustodian(CONTENT_SETTINGS_TYPE_MEDIASTREAM);
}
static jboolean GetAutologinEnabled(JNIEnv* env, jobject obj) {

Powered by Google App Engine
This is Rietveld 408576698