| 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.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import android.Manifest; | 7 import android.Manifest; |
| 8 import android.annotation.SuppressLint; |
| 8 import android.content.pm.PackageManager; | 9 import android.content.pm.PackageManager; |
| 9 import android.os.Process; | 10 import android.os.Process; |
| 10 | 11 |
| 11 import org.chromium.base.ApiCompatibilityUtils; | 12 import org.chromium.base.ApiCompatibilityUtils; |
| 12 import org.chromium.base.ContextUtils; | 13 import org.chromium.base.ContextUtils; |
| 13 import org.chromium.base.ThreadUtils; | 14 import org.chromium.base.ThreadUtils; |
| 14 import org.chromium.base.annotations.CalledByNative; | 15 import org.chromium.base.annotations.CalledByNative; |
| 15 import org.chromium.base.annotations.JNINamespace; | 16 import org.chromium.base.annotations.JNINamespace; |
| 16 import org.chromium.base.annotations.NativeClassQualifiedName; | 17 import org.chromium.base.annotations.NativeClassQualifiedName; |
| 17 import org.chromium.base.metrics.RecordHistogram; | 18 import org.chromium.base.metrics.RecordHistogram; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 33 * | 34 * |
| 34 * This class lives on the main thread. | 35 * This class lives on the main thread. |
| 35 */ | 36 */ |
| 36 @JNINamespace("content") | 37 @JNINamespace("content") |
| 37 class BackgroundSyncNetworkObserver implements NetworkChangeNotifierAutoDetect.O
bserver { | 38 class BackgroundSyncNetworkObserver implements NetworkChangeNotifierAutoDetect.O
bserver { |
| 38 private static final String TAG = "cr_BgSyncNetObserver"; | 39 private static final String TAG = "cr_BgSyncNetObserver"; |
| 39 | 40 |
| 40 private NetworkChangeNotifierAutoDetect mNotifier; | 41 private NetworkChangeNotifierAutoDetect mNotifier; |
| 41 | 42 |
| 42 // The singleton instance. | 43 // The singleton instance. |
| 44 @SuppressLint("StaticFieldLeak") |
| 43 private static BackgroundSyncNetworkObserver sInstance; | 45 private static BackgroundSyncNetworkObserver sInstance; |
| 44 | 46 |
| 45 // List of native observers. These are each called when the network state ch
anges. | 47 // List of native observers. These are each called when the network state ch
anges. |
| 46 private List<Long> mNativePtrs; | 48 private List<Long> mNativePtrs; |
| 47 | 49 |
| 48 private BackgroundSyncNetworkObserver() { | 50 private BackgroundSyncNetworkObserver() { |
| 49 ThreadUtils.assertOnUiThread(); | 51 ThreadUtils.assertOnUiThread(); |
| 50 mNativePtrs = new ArrayList<Long>(); | 52 mNativePtrs = new ArrayList<Long>(); |
| 51 } | 53 } |
| 52 | 54 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 @Override | 116 @Override |
| 115 public void onNetworkSoonToDisconnect(long netId) {} | 117 public void onNetworkSoonToDisconnect(long netId) {} |
| 116 @Override | 118 @Override |
| 117 public void onNetworkDisconnect(long netId) {} | 119 public void onNetworkDisconnect(long netId) {} |
| 118 @Override | 120 @Override |
| 119 public void purgeActiveNetworkList(long[] activeNetIds) {} | 121 public void purgeActiveNetworkList(long[] activeNetIds) {} |
| 120 | 122 |
| 121 @NativeClassQualifiedName("BackgroundSyncNetworkObserverAndroid::Observer") | 123 @NativeClassQualifiedName("BackgroundSyncNetworkObserverAndroid::Observer") |
| 122 private native void nativeNotifyConnectionTypeChanged(long nativePtr, int ne
wConnectionType); | 124 private native void nativeNotifyConnectionTypeChanged(long nativePtr, int ne
wConnectionType); |
| 123 } | 125 } |
| OLD | NEW |