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

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: 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
« no previous file with comments | « no previous file | chrome/browser/content_settings/content_settings_supervised_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4512ce62716f712add1225d5c0b96ab5da250b1a..1ba7a70bbe7e3477683a1d3fd8f3cdbd6d50e762 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) {
« no previous file with comments | « no previous file | chrome/browser/content_settings/content_settings_supervised_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698