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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java

Issue 1050473002: Migrate Location and Protected Media Identifier Settings at startup instead of the getter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Comment Created 5 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/android/preferences/pref_service_bridge.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 package org.chromium.chrome.browser.preferences; 5 package org.chromium.chrome.browser.preferences;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.content.SharedPreferences; 8 import android.content.SharedPreferences;
9 import android.preference.PreferenceManager; 9 import android.preference.PreferenceManager;
10 import android.text.TextUtils; 10 import android.text.TextUtils;
(...skipping 23 matching lines...) Expand all
34 public static final String EXCEPTION_SETTING_BLOCK = "block"; 34 public static final String EXCEPTION_SETTING_BLOCK = "block";
35 public static final String EXCEPTION_SETTING_DEFAULT = "default"; 35 public static final String EXCEPTION_SETTING_DEFAULT = "default";
36 36
37 // These values must match the native enum values in 37 // These values must match the native enum values in
38 // SupervisedUserURLFilter::FilteringBehavior 38 // SupervisedUserURLFilter::FilteringBehavior
39 public static final int SUPERVISED_USER_FILTERING_ALLOW = 0; 39 public static final int SUPERVISED_USER_FILTERING_ALLOW = 0;
40 public static final int SUPERVISED_USER_FILTERING_WARN = 1; 40 public static final int SUPERVISED_USER_FILTERING_WARN = 1;
41 public static final int SUPERVISED_USER_FILTERING_BLOCK = 2; 41 public static final int SUPERVISED_USER_FILTERING_BLOCK = 2;
42 42
43 private static final String MIGRATION_PREF_KEY = "PrefMigrationVersion"; 43 private static final String MIGRATION_PREF_KEY = "PrefMigrationVersion";
44 private static final int MIGRATION_CURRENT_VERSION = 2; 44 private static final int MIGRATION_CURRENT_VERSION = 3;
45 45
46 private static String sProfilePath; 46 private static String sProfilePath;
47 47
48 // Object to notify when "clear browsing data" completes. 48 // Object to notify when "clear browsing data" completes.
49 private OnClearBrowsingDataListener mClearBrowsingDataListener; 49 private OnClearBrowsingDataListener mClearBrowsingDataListener;
50 private static final String LOG_TAG = "PrefServiceBridge"; 50 private static final String LOG_TAG = "PrefServiceBridge";
51 51
52 // Constants related to the Contextual Search preference. 52 // Constants related to the Contextual Search preference.
53 private static final String CONTEXTUAL_SEARCH_DISABLED = "false"; 53 private static final String CONTEXTUAL_SEARCH_DISABLED = "false";
54 private static final String CONTEXTUAL_SEARCH_ENABLED = "true"; 54 private static final String CONTEXTUAL_SEARCH_ENABLED = "true";
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 + "run an older version of Chrome without clearing data is u nsupported and " 143 + "run an older version of Chrome without clearing data is u nsupported and "
144 + "the results may be unpredictable."); 144 + "the results may be unpredictable.");
145 } 145 }
146 146
147 if (currentVersion < 1) { 147 if (currentVersion < 1) {
148 nativeMigrateJavascriptPreference(); 148 nativeMigrateJavascriptPreference();
149 } 149 }
150 if (currentVersion < 2) { 150 if (currentVersion < 2) {
151 addDefaultSearchEnginePermission(context); 151 addDefaultSearchEnginePermission(context);
152 } 152 }
153 if (currentVersion < 3) {
154 nativeMigrateLocationPreference();
155 nativeMigrateProtectedMediaPreference();
156 }
153 preferences.edit().putInt(MIGRATION_PREF_KEY, MIGRATION_CURRENT_VERSION) .commit(); 157 preferences.edit().putInt(MIGRATION_PREF_KEY, MIGRATION_CURRENT_VERSION) .commit();
154 } 158 }
155 159
156 /** 160 /**
157 * Add a permission entry for Location for the default search engine. 161 * Add a permission entry for Location for the default search engine.
158 */ 162 */
159 private void addDefaultSearchEnginePermission(final Context context) { 163 private void addDefaultSearchEnginePermission(final Context context) {
160 TemplateUrlService templateUrlService = TemplateUrlService.getInstance() ; 164 TemplateUrlService templateUrlService = TemplateUrlService.getInstance() ;
161 if (!templateUrlService.isLoaded()) { 165 if (!templateUrlService.isLoaded()) {
162 templateUrlService.registerLoadListener(new LoadListener() { 166 templateUrlService.registerLoadListener(new LoadListener() {
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 private native boolean nativeGetIncognitoModeEnabled(); 886 private native boolean nativeGetIncognitoModeEnabled();
883 private native boolean nativeGetIncognitoModeManaged(); 887 private native boolean nativeGetIncognitoModeManaged();
884 private native boolean nativeGetPrintingEnabled(); 888 private native boolean nativeGetPrintingEnabled();
885 private native boolean nativeGetPrintingManaged(); 889 private native boolean nativeGetPrintingManaged();
886 private native boolean nativeGetForceSafeSearch(); 890 private native boolean nativeGetForceSafeSearch();
887 private native void nativeSetTranslateEnabled(boolean enabled); 891 private native void nativeSetTranslateEnabled(boolean enabled);
888 private native void nativeResetTranslateDefaults(); 892 private native void nativeResetTranslateDefaults();
889 private native boolean nativeGetJavaScriptEnabled(); 893 private native boolean nativeGetJavaScriptEnabled();
890 private native void nativeSetJavaScriptEnabled(boolean enabled); 894 private native void nativeSetJavaScriptEnabled(boolean enabled);
891 private native void nativeMigrateJavascriptPreference(); 895 private native void nativeMigrateJavascriptPreference();
896 private native void nativeMigrateLocationPreference();
897 private native void nativeMigrateProtectedMediaPreference();
892 private native void nativeSetJavaScriptAllowed(String pattern, int setting); 898 private native void nativeSetJavaScriptAllowed(String pattern, int setting);
893 private native void nativeGetJavaScriptExceptions(List<JavaScriptExceptionIn fo> list); 899 private native void nativeGetJavaScriptExceptions(List<JavaScriptExceptionIn fo> list);
894 private native void nativeClearBrowsingData(boolean history, boolean cache, 900 private native void nativeClearBrowsingData(boolean history, boolean cache,
895 boolean cookiesAndSiteData, boolean passwords, boolean formData); 901 boolean cookiesAndSiteData, boolean passwords, boolean formData);
896 private native boolean nativeCanDeleteBrowsingHistory(); 902 private native boolean nativeCanDeleteBrowsingHistory();
897 private native void nativeSetAllowCookiesEnabled(boolean allow); 903 private native void nativeSetAllowCookiesEnabled(boolean allow);
898 private native void nativeSetBlockThirdPartyCookiesEnabled(boolean enabled); 904 private native void nativeSetBlockThirdPartyCookiesEnabled(boolean enabled);
899 private native void nativeSetDoNotTrackEnabled(boolean enabled); 905 private native void nativeSetDoNotTrackEnabled(boolean enabled);
900 private native void nativeSetFullscreenAllowed(boolean allowed); 906 private native void nativeSetFullscreenAllowed(boolean allowed);
901 private native void nativeSetRememberPasswordsEnabled(boolean allow); 907 private native void nativeSetRememberPasswordsEnabled(boolean allow);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 private native void nativeResetAcceptLanguages(String defaultLocale); 942 private native void nativeResetAcceptLanguages(String defaultLocale);
937 private native String nativeGetSyncLastAccountName(); 943 private native String nativeGetSyncLastAccountName();
938 private native String nativeGetSupervisedUserCustodianName(); 944 private native String nativeGetSupervisedUserCustodianName();
939 private native String nativeGetSupervisedUserCustodianEmail(); 945 private native String nativeGetSupervisedUserCustodianEmail();
940 private native String nativeGetSupervisedUserCustodianProfileImageURL(); 946 private native String nativeGetSupervisedUserCustodianProfileImageURL();
941 private native int nativeGetDefaultSupervisedUserFilteringBehavior(); 947 private native int nativeGetDefaultSupervisedUserFilteringBehavior();
942 private native String nativeGetSupervisedUserSecondCustodianName(); 948 private native String nativeGetSupervisedUserSecondCustodianName();
943 private native String nativeGetSupervisedUserSecondCustodianEmail(); 949 private native String nativeGetSupervisedUserSecondCustodianEmail();
944 private native String nativeGetSupervisedUserSecondCustodianProfileImageURL( ); 950 private native String nativeGetSupervisedUserSecondCustodianProfileImageURL( );
945 } 951 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/preferences/pref_service_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698