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.content.Context; | 7 import android.content.Context; |
8 import android.content.SharedPreferences; | 8 import android.content.SharedPreferences; |
9 import android.net.ConnectivityManager; | 9 import android.net.ConnectivityManager; |
10 import android.net.NetworkInfo; | 10 import android.net.NetworkInfo; |
11 | 11 |
12 import org.chromium.base.CommandLine; | 12 import org.chromium.base.CommandLine; |
13 import org.chromium.base.ContextUtils; | 13 import org.chromium.base.ContextUtils; |
14 import org.chromium.base.VisibleForTesting; | 14 import org.chromium.base.VisibleForTesting; |
15 import org.chromium.chrome.R; | 15 import org.chromium.chrome.R; |
16 import org.chromium.chrome.browser.ChromeApplication; | |
17 import org.chromium.chrome.browser.ChromeSwitches; | 16 import org.chromium.chrome.browser.ChromeSwitches; |
18 import org.chromium.chrome.browser.device.DeviceClassManager; | 17 import org.chromium.chrome.browser.device.DeviceClassManager; |
19 import org.chromium.chrome.browser.physicalweb.PhysicalWeb; | 18 import org.chromium.chrome.browser.physicalweb.PhysicalWeb; |
20 import org.chromium.chrome.browser.preferences.PrefServiceBridge; | 19 import org.chromium.chrome.browser.preferences.PrefServiceBridge; |
21 | 20 |
22 /** | 21 /** |
23 * Reads, writes, and migrates preferences related to network usage and privacy. | 22 * Reads, writes, and migrates preferences related to network usage and privacy. |
24 */ | 23 */ |
25 public class PrivacyPreferencesManager implements CrashReportingPermissionManage
r{ | 24 public class PrivacyPreferencesManager implements CrashReportingPermissionManage
r{ |
26 | 25 |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 * and displays a notification when beacons are found. | 433 * and displays a notification when beacons are found. |
435 * | 434 * |
436 * @param enabled A boolean indicating whether to notify on nearby beacons. | 435 * @param enabled A boolean indicating whether to notify on nearby beacons. |
437 */ | 436 */ |
438 public void setPhysicalWebEnabled(boolean enabled) { | 437 public void setPhysicalWebEnabled(boolean enabled) { |
439 int state = enabled ? PHYSICAL_WEB_ON : PHYSICAL_WEB_OFF; | 438 int state = enabled ? PHYSICAL_WEB_ON : PHYSICAL_WEB_OFF; |
440 boolean isOnboarding = isPhysicalWebOnboarding(); | 439 boolean isOnboarding = isPhysicalWebOnboarding(); |
441 mSharedPreferences.edit().putInt(PREF_PHYSICAL_WEB, state).apply(); | 440 mSharedPreferences.edit().putInt(PREF_PHYSICAL_WEB, state).apply(); |
442 if (enabled) { | 441 if (enabled) { |
443 if (!isOnboarding) { | 442 if (!isOnboarding) { |
444 PhysicalWeb.startPhysicalWeb((ChromeApplication) mContext); | 443 PhysicalWeb.startPhysicalWeb(); |
445 } | 444 } |
446 } else { | 445 } else { |
447 PhysicalWeb.stopPhysicalWeb((ChromeApplication) mContext); | 446 PhysicalWeb.stopPhysicalWeb(); |
448 } | 447 } |
449 } | 448 } |
450 | 449 |
451 /** | 450 /** |
452 * Check whether the user is still in the Physical Web onboarding flow. | 451 * Check whether the user is still in the Physical Web onboarding flow. |
453 * | 452 * |
454 * @return boolean {@code true} if onboarding is not yet complete. | 453 * @return boolean {@code true} if onboarding is not yet complete. |
455 */ | 454 */ |
456 public boolean isPhysicalWebOnboarding() { | 455 public boolean isPhysicalWebOnboarding() { |
457 int state = mSharedPreferences.getInt(PREF_PHYSICAL_WEB, PHYSICAL_WEB_ON
BOARDING); | 456 int state = mSharedPreferences.getInt(PREF_PHYSICAL_WEB, PHYSICAL_WEB_ON
BOARDING); |
(...skipping 27 matching lines...) Expand all Loading... |
485 */ | 484 */ |
486 public void syncUsageAndCrashReportingPrefs() { | 485 public void syncUsageAndCrashReportingPrefs() { |
487 boolean isUploadUserPermitted = isUploadUserPermitted(); | 486 boolean isUploadUserPermitted = isUploadUserPermitted(); |
488 if (isCellularExperimentEnabled()) { | 487 if (isCellularExperimentEnabled()) { |
489 PrefServiceBridge.getInstance().setMetricsReportingEnabled(isUploadU
serPermitted); | 488 PrefServiceBridge.getInstance().setMetricsReportingEnabled(isUploadU
serPermitted); |
490 } | 489 } |
491 | 490 |
492 PrefServiceBridge.getInstance().setCrashReportingEnabled(isUploadUserPer
mitted); | 491 PrefServiceBridge.getInstance().setCrashReportingEnabled(isUploadUserPer
mitted); |
493 } | 492 } |
494 } | 493 } |
OLD | NEW |