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

Side by Side Diff: chrome/browser/android/preferences/pref_service_bridge.cc

Issue 2039953002: Add a preference for disabling vibration in notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Address Dan's comments. Created 4 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/android/preferences/pref_service_bridge.h" 5 #include "chrome/browser/android/preferences/pref_service_bridge.h"
6 6
7 #include <jni.h> 7 #include <jni.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 const JavaParamRef<jobject>& obj) { 361 const JavaParamRef<jobject>& obj) {
362 return GetBooleanForContentSetting( 362 return GetBooleanForContentSetting(
363 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER); 363 CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER);
364 } 364 }
365 365
366 static jboolean GetNotificationsEnabled(JNIEnv* env, 366 static jboolean GetNotificationsEnabled(JNIEnv* env,
367 const JavaParamRef<jobject>& obj) { 367 const JavaParamRef<jobject>& obj) {
368 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_NOTIFICATIONS); 368 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
369 } 369 }
370 370
371 static jboolean GetNotificationsVibrateEnabled(
372 JNIEnv* env,
373 const JavaParamRef<jobject>& obj) {
374 return GetPrefService()->GetBoolean(prefs::kNotificationsVibrateEnabled);
375 }
376
371 static jboolean GetAllowLocationEnabled(JNIEnv* env, 377 static jboolean GetAllowLocationEnabled(JNIEnv* env,
372 const JavaParamRef<jobject>& obj) { 378 const JavaParamRef<jobject>& obj) {
373 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_GEOLOCATION); 379 return GetBooleanForContentSetting(CONTENT_SETTINGS_TYPE_GEOLOCATION);
374 } 380 }
375 381
376 static jboolean GetLocationAllowedByPolicy(JNIEnv* env, 382 static jboolean GetLocationAllowedByPolicy(JNIEnv* env,
377 const JavaParamRef<jobject>& obj) { 383 const JavaParamRef<jobject>& obj) {
378 if (!IsContentSettingManaged(CONTENT_SETTINGS_TYPE_GEOLOCATION)) 384 if (!IsContentSettingManaged(CONTENT_SETTINGS_TYPE_GEOLOCATION))
379 return false; 385 return false;
380 HostContentSettingsMap* content_settings = 386 HostContentSettingsMap* content_settings =
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 static void SetNotificationsEnabled(JNIEnv* env, 821 static void SetNotificationsEnabled(JNIEnv* env,
816 const JavaParamRef<jobject>& obj, 822 const JavaParamRef<jobject>& obj,
817 jboolean allow) { 823 jboolean allow) {
818 HostContentSettingsMap* host_content_settings_map = 824 HostContentSettingsMap* host_content_settings_map =
819 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile()); 825 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile());
820 host_content_settings_map->SetDefaultContentSetting( 826 host_content_settings_map->SetDefaultContentSetting(
821 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 827 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
822 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK); 828 allow ? CONTENT_SETTING_ASK : CONTENT_SETTING_BLOCK);
823 } 829 }
824 830
831 static void SetNotificationsVibrateEnabled(JNIEnv* env,
832 const JavaParamRef<jobject>& obj,
833 jboolean enabled) {
834 GetPrefService()->SetBoolean(prefs::kNotificationsVibrateEnabled, enabled);
835 }
836
825 static void SetCrashReportingEnabled(JNIEnv* env, 837 static void SetCrashReportingEnabled(JNIEnv* env,
826 const JavaParamRef<jobject>& obj, 838 const JavaParamRef<jobject>& obj,
827 jboolean reporting) { 839 jboolean reporting) {
828 PrefService* local_state = g_browser_process->local_state(); 840 PrefService* local_state = g_browser_process->local_state();
829 local_state->SetBoolean(prefs::kCrashReportingEnabled, reporting); 841 local_state->SetBoolean(prefs::kCrashReportingEnabled, reporting);
830 } 842 }
831 843
832 static jboolean IsCrashReportingEnabled(JNIEnv* env, 844 static jboolean IsCrashReportingEnabled(JNIEnv* env,
833 const JavaParamRef<jobject>& obj) { 845 const JavaParamRef<jobject>& obj) {
834 PrefService* local_state = g_browser_process->local_state(); 846 PrefService* local_state = g_browser_process->local_state();
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 1161
1150 return ConvertJavaStringToUTF8(android_permission); 1162 return ConvertJavaStringToUTF8(android_permission);
1151 } 1163 }
1152 1164
1153 static void SetSupervisedUserId(JNIEnv* env, 1165 static void SetSupervisedUserId(JNIEnv* env,
1154 const JavaParamRef<jobject>& obj, 1166 const JavaParamRef<jobject>& obj,
1155 const JavaParamRef<jstring>& pref) { 1167 const JavaParamRef<jstring>& pref) {
1156 GetPrefService()->SetString(prefs::kSupervisedUserId, 1168 GetPrefService()->SetString(prefs::kSupervisedUserId,
1157 ConvertJavaStringToUTF8(env, pref)); 1169 ConvertJavaStringToUTF8(env, pref));
1158 } 1170 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698