| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.privacy; | 5 package org.chromium.chrome.browser.preferences.privacy; |
| 6 | 6 |
| 7 import android.annotation.SuppressLint; |
| 7 import android.content.Context; | 8 import android.content.Context; |
| 8 import android.content.SharedPreferences; | 9 import android.content.SharedPreferences; |
| 9 import android.net.ConnectivityManager; | 10 import android.net.ConnectivityManager; |
| 10 import android.net.NetworkInfo; | 11 import android.net.NetworkInfo; |
| 11 | 12 |
| 12 import org.chromium.base.CommandLine; | 13 import org.chromium.base.CommandLine; |
| 13 import org.chromium.base.ContextUtils; | 14 import org.chromium.base.ContextUtils; |
| 14 import org.chromium.base.VisibleForTesting; | 15 import org.chromium.base.VisibleForTesting; |
| 15 import org.chromium.chrome.browser.ChromeSwitches; | 16 import org.chromium.chrome.browser.ChromeSwitches; |
| 16 import org.chromium.chrome.browser.device.DeviceClassManager; | 17 import org.chromium.chrome.browser.device.DeviceClassManager; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 32 private static final String PREF_METRICS_IN_SAMPLE = "in_metrics_sample"; | 33 private static final String PREF_METRICS_IN_SAMPLE = "in_metrics_sample"; |
| 33 private static final String PREF_NETWORK_PREDICTIONS = "network_predictions"
; | 34 private static final String PREF_NETWORK_PREDICTIONS = "network_predictions"
; |
| 34 private static final String PREF_BANDWIDTH_OLD = "prefetch_bandwidth"; | 35 private static final String PREF_BANDWIDTH_OLD = "prefetch_bandwidth"; |
| 35 private static final String PREF_BANDWIDTH_NO_CELLULAR_OLD = "prefetch_bandw
idth_no_cellular"; | 36 private static final String PREF_BANDWIDTH_NO_CELLULAR_OLD = "prefetch_bandw
idth_no_cellular"; |
| 36 private static final String ALLOW_PRERENDER_OLD = "allow_prefetch"; | 37 private static final String ALLOW_PRERENDER_OLD = "allow_prefetch"; |
| 37 private static final String PREF_PHYSICAL_WEB = "physical_web"; | 38 private static final String PREF_PHYSICAL_WEB = "physical_web"; |
| 38 private static final int PHYSICAL_WEB_OFF = 0; | 39 private static final int PHYSICAL_WEB_OFF = 0; |
| 39 private static final int PHYSICAL_WEB_ON = 1; | 40 private static final int PHYSICAL_WEB_ON = 1; |
| 40 private static final int PHYSICAL_WEB_ONBOARDING = 2; | 41 private static final int PHYSICAL_WEB_ONBOARDING = 2; |
| 41 | 42 |
| 43 @SuppressLint("StaticFieldLeak") |
| 42 private static PrivacyPreferencesManager sInstance; | 44 private static PrivacyPreferencesManager sInstance; |
| 43 | 45 |
| 44 private final Context mContext; | 46 private final Context mContext; |
| 45 private final SharedPreferences mSharedPreferences; | 47 private final SharedPreferences mSharedPreferences; |
| 46 | 48 |
| 47 @VisibleForTesting | 49 @VisibleForTesting |
| 48 PrivacyPreferencesManager(Context context) { | 50 PrivacyPreferencesManager(Context context) { |
| 49 mContext = context; | 51 mContext = context; |
| 50 mSharedPreferences = ContextUtils.getAppSharedPreferences(); | 52 mSharedPreferences = ContextUtils.getAppSharedPreferences(); |
| 51 | 53 |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 /** | 328 /** |
| 327 * Check whether Physical Web is configured to notify on nearby beacons. | 329 * Check whether Physical Web is configured to notify on nearby beacons. |
| 328 * | 330 * |
| 329 * @return boolean {@code true} if the feature is enabled. | 331 * @return boolean {@code true} if the feature is enabled. |
| 330 */ | 332 */ |
| 331 public boolean isPhysicalWebEnabled() { | 333 public boolean isPhysicalWebEnabled() { |
| 332 int state = mSharedPreferences.getInt(PREF_PHYSICAL_WEB, PHYSICAL_WEB_ON
BOARDING); | 334 int state = mSharedPreferences.getInt(PREF_PHYSICAL_WEB, PHYSICAL_WEB_ON
BOARDING); |
| 333 return (state == PHYSICAL_WEB_ON); | 335 return (state == PHYSICAL_WEB_ON); |
| 334 } | 336 } |
| 335 } | 337 } |
| OLD | NEW |