| OLD | NEW |
| 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 19 matching lines...) Expand all Loading... |
| 30 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 30 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 31 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h" | 31 #include "chrome/browser/browsing_data/registrable_domain_filter_builder.h" |
| 32 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 32 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 33 #include "chrome/browser/history/web_history_service_factory.h" | 33 #include "chrome/browser/history/web_history_service_factory.h" |
| 34 #include "chrome/browser/net/prediction_options.h" | 34 #include "chrome/browser/net/prediction_options.h" |
| 35 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 35 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 36 #include "chrome/browser/profiles/profile_manager.h" | 36 #include "chrome/browser/profiles/profile_manager.h" |
| 37 #include "chrome/browser/sync/profile_sync_service_factory.h" | 37 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 38 #include "chrome/browser/translate/chrome_translate_client.h" | 38 #include "chrome/browser/translate/chrome_translate_client.h" |
| 39 #include "chrome/browser/ui/android/android_about_app_info.h" | 39 #include "chrome/browser/ui/android/android_about_app_info.h" |
| 40 #include "chrome/common/channel_info.h" |
| 40 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
| 41 #include "chrome/grit/locale_settings.h" | 42 #include "chrome/grit/locale_settings.h" |
| 43 #include "components/browser_sync/browser/profile_sync_service.h" |
| 42 #include "components/browsing_data_ui/history_notice_utils.h" | 44 #include "components/browsing_data_ui/history_notice_utils.h" |
| 43 #include "components/content_settings/core/browser/host_content_settings_map.h" | 45 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 44 #include "components/content_settings/core/common/content_settings.h" | 46 #include "components/content_settings/core/common/content_settings.h" |
| 45 #include "components/content_settings/core/common/content_settings_pattern.h" | 47 #include "components/content_settings/core/common/content_settings_pattern.h" |
| 46 #include "components/content_settings/core/common/pref_names.h" | 48 #include "components/content_settings/core/common/pref_names.h" |
| 47 #include "components/metrics/metrics_pref_names.h" | 49 #include "components/metrics/metrics_pref_names.h" |
| 48 #include "components/password_manager/core/common/password_manager_pref_names.h" | 50 #include "components/password_manager/core/common/password_manager_pref_names.h" |
| 49 #include "components/prefs/pref_service.h" | 51 #include "components/prefs/pref_service.h" |
| 50 #include "components/signin/core/common/signin_pref_names.h" | 52 #include "components/signin/core/common/signin_pref_names.h" |
| 51 #include "components/strings/grit/components_locale_settings.h" | 53 #include "components/strings/grit/components_locale_settings.h" |
| 52 #include "components/translate/core/browser/translate_prefs.h" | 54 #include "components/translate/core/browser/translate_prefs.h" |
| 53 #include "components/translate/core/common/translate_pref_names.h" | 55 #include "components/translate/core/common/translate_pref_names.h" |
| 54 #include "components/version_info/version_info.h" | 56 #include "components/version_info/version_info.h" |
| 55 #include "components/web_resource/web_resource_pref_names.h" | 57 #include "components/web_resource/web_resource_pref_names.h" |
| 56 #include "content/public/browser/browser_thread.h" | 58 #include "content/public/browser/browser_thread.h" |
| 57 #include "content/public/browser/user_metrics.h" | 59 #include "content/public/browser/user_metrics.h" |
| 58 #include "jni/PrefServiceBridge_jni.h" | 60 #include "jni/PrefServiceBridge_jni.h" |
| 61 #include "ui/base/device_form_factor.h" |
| 59 #include "ui/base/l10n/l10n_util.h" | 62 #include "ui/base/l10n/l10n_util.h" |
| 60 | 63 |
| 61 using base::android::AttachCurrentThread; | 64 using base::android::AttachCurrentThread; |
| 62 using base::android::CheckException; | 65 using base::android::CheckException; |
| 63 using base::android::ConvertJavaStringToUTF8; | 66 using base::android::ConvertJavaStringToUTF8; |
| 64 using base::android::ConvertUTF8ToJavaString; | 67 using base::android::ConvertUTF8ToJavaString; |
| 65 using base::android::ScopedJavaLocalRef; | 68 using base::android::ScopedJavaLocalRef; |
| 66 using base::android::ScopedJavaGlobalRef; | 69 using base::android::ScopedJavaGlobalRef; |
| 67 using content::BrowserThread; | 70 using content::BrowserThread; |
| 68 | 71 |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 browsing_data_ui::ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( | 692 browsing_data_ui::ShouldShowNoticeAboutOtherFormsOfBrowsingHistory( |
| 690 ProfileSyncServiceFactory::GetForProfile(GetOriginalProfile()), | 693 ProfileSyncServiceFactory::GetForProfile(GetOriginalProfile()), |
| 691 WebHistoryServiceFactory::GetForProfile(GetOriginalProfile()), | 694 WebHistoryServiceFactory::GetForProfile(GetOriginalProfile()), |
| 692 base::Bind(&ShowNoticeAboutOtherFormsOfBrowsingHistory, | 695 base::Bind(&ShowNoticeAboutOtherFormsOfBrowsingHistory, |
| 693 base::Owned(new ScopedJavaGlobalRef<jobject>(env, listener)))); | 696 base::Owned(new ScopedJavaGlobalRef<jobject>(env, listener)))); |
| 694 | 697 |
| 695 // The one-time notice in the dialog. | 698 // The one-time notice in the dialog. |
| 696 browsing_data_ui::ShouldPopupDialogAboutOtherFormsOfBrowsingHistory( | 699 browsing_data_ui::ShouldPopupDialogAboutOtherFormsOfBrowsingHistory( |
| 697 ProfileSyncServiceFactory::GetForProfile(GetOriginalProfile()), | 700 ProfileSyncServiceFactory::GetForProfile(GetOriginalProfile()), |
| 698 WebHistoryServiceFactory::GetForProfile(GetOriginalProfile()), | 701 WebHistoryServiceFactory::GetForProfile(GetOriginalProfile()), |
| 702 chrome::GetChannel(), |
| 703 ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET, |
| 699 base::Bind(&EnableDialogAboutOtherFormsOfBrowsingHistory, | 704 base::Bind(&EnableDialogAboutOtherFormsOfBrowsingHistory, |
| 700 base::Owned(new ScopedJavaGlobalRef<jobject>(env, listener)))); | 705 base::Owned(new ScopedJavaGlobalRef<jobject>(env, listener)))); |
| 701 } | 706 } |
| 702 | 707 |
| 703 static void SetAutoplayEnabled(JNIEnv* env, | 708 static void SetAutoplayEnabled(JNIEnv* env, |
| 704 const JavaParamRef<jobject>& obj, | 709 const JavaParamRef<jobject>& obj, |
| 705 jboolean allow) { | 710 jboolean allow) { |
| 706 HostContentSettingsMap* host_content_settings_map = | 711 HostContentSettingsMap* host_content_settings_map = |
| 707 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile()); | 712 HostContentSettingsMapFactory::GetForProfile(GetOriginalProfile()); |
| 708 host_content_settings_map->SetDefaultContentSetting( | 713 host_content_settings_map->SetDefaultContentSetting( |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 | 1137 |
| 1133 return ConvertJavaStringToUTF8(android_permission); | 1138 return ConvertJavaStringToUTF8(android_permission); |
| 1134 } | 1139 } |
| 1135 | 1140 |
| 1136 static void SetSupervisedUserId(JNIEnv* env, | 1141 static void SetSupervisedUserId(JNIEnv* env, |
| 1137 const JavaParamRef<jobject>& obj, | 1142 const JavaParamRef<jobject>& obj, |
| 1138 const JavaParamRef<jstring>& pref) { | 1143 const JavaParamRef<jstring>& pref) { |
| 1139 GetPrefService()->SetString(prefs::kSupervisedUserId, | 1144 GetPrefService()->SetString(prefs::kSupervisedUserId, |
| 1140 ConvertJavaStringToUTF8(env, pref)); | 1145 ConvertJavaStringToUTF8(env, pref)); |
| 1141 } | 1146 } |
| OLD | NEW |