| 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.datausage; | 5 package org.chromium.chrome.browser.datausage; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.text.TextUtils; | 8 import android.text.TextUtils; |
| 9 | 9 |
| 10 import org.chromium.base.ApplicationState; | 10 import org.chromium.base.ApplicationState; |
| 11 import org.chromium.base.ApplicationStatus; | 11 import org.chromium.base.ApplicationStatus; |
| 12 import org.chromium.base.ContextUtils; | 12 import org.chromium.base.ContextUtils; |
| 13 import org.chromium.base.PackageUtils; | 13 import org.chromium.base.PackageUtils; |
| 14 import org.chromium.base.annotations.CalledByNative; | 14 import org.chromium.base.annotations.CalledByNative; |
| 15 import org.chromium.base.annotations.JNINamespace; | 15 import org.chromium.base.annotations.JNINamespace; |
| 16 import org.chromium.base.annotations.NativeClassQualifiedName; | 16 import org.chromium.base.annotations.NativeClassQualifiedName; |
| 17 import org.chromium.chrome.browser.ChromeApplication; | 17 import org.chromium.chrome.browser.AppHooks; |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * This class provides a base class implementation of a data use observer that i
s external to | 20 * This class provides a base class implementation of a data use observer that i
s external to |
| 21 * Chromium. This class should be accessed only on UI thread. | 21 * Chromium. This class should be accessed only on UI thread. |
| 22 */ | 22 */ |
| 23 @JNINamespace("chrome::android") | 23 @JNINamespace("chrome::android") |
| 24 public class ExternalDataUseObserver { | 24 public class ExternalDataUseObserver { |
| 25 /** | 25 /** |
| 26 * Listens for application state changes and whenever Chromium state changes
to running, checks | 26 * Listens for application state changes and whenever Chromium state changes
to running, checks |
| 27 * and notifies {@link #ExternalDataUseObserverBridge} if the control app ge
ts installed or | 27 * and notifies {@link #ExternalDataUseObserverBridge} if the control app ge
ts installed or |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 */ | 82 */ |
| 83 private long mNativeExternalDataUseObserverBridge; | 83 private long mNativeExternalDataUseObserverBridge; |
| 84 | 84 |
| 85 /** | 85 /** |
| 86 * {@link #ControlAppManager} object that notifies when control app is insta
lled. | 86 * {@link #ControlAppManager} object that notifies when control app is insta
lled. |
| 87 */ | 87 */ |
| 88 private ControlAppManager mControlAppManager; | 88 private ControlAppManager mControlAppManager; |
| 89 | 89 |
| 90 @CalledByNative | 90 @CalledByNative |
| 91 private static ExternalDataUseObserver create(Context context, long nativePt
r) { | 91 private static ExternalDataUseObserver create(Context context, long nativePt
r) { |
| 92 return ((ChromeApplication) context).createExternalDataUseObserver(nativ
ePtr); | 92 return AppHooks.get().createExternalDataUseObserver(nativePtr); |
| 93 } | 93 } |
| 94 | 94 |
| 95 /** | 95 /** |
| 96 * Creates an instance of {@link #ExternalDataUseObserver}. | 96 * Creates an instance of {@link #ExternalDataUseObserver}. |
| 97 * @param nativePtr pointer to the native ExternalDataUseObserver object. | 97 * @param nativePtr pointer to the native ExternalDataUseObserver object. |
| 98 */ | 98 */ |
| 99 public ExternalDataUseObserver(long nativePtr) { | 99 public ExternalDataUseObserver(long nativePtr) { |
| 100 mNativeExternalDataUseObserverBridge = nativePtr; | 100 mNativeExternalDataUseObserverBridge = nativePtr; |
| 101 assert mNativeExternalDataUseObserverBridge != 0; | 101 assert mNativeExternalDataUseObserverBridge != 0; |
| 102 } | 102 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 String[] appPackageName, String[] domainPathRegEx, String[] label); | 209 String[] appPackageName, String[] domainPathRegEx, String[] label); |
| 210 | 210 |
| 211 @NativeClassQualifiedName("ExternalDataUseObserverBridge") | 211 @NativeClassQualifiedName("ExternalDataUseObserverBridge") |
| 212 private native void nativeOnReportDataUseDone( | 212 private native void nativeOnReportDataUseDone( |
| 213 long nativeExternalDataUseObserver, boolean success); | 213 long nativeExternalDataUseObserver, boolean success); |
| 214 | 214 |
| 215 @NativeClassQualifiedName("ExternalDataUseObserverBridge") | 215 @NativeClassQualifiedName("ExternalDataUseObserverBridge") |
| 216 private native void nativeOnControlAppInstallStateChange( | 216 private native void nativeOnControlAppInstallStateChange( |
| 217 long nativeExternalDataUseObserver, boolean isControlAppInstalled); | 217 long nativeExternalDataUseObserver, boolean isControlAppInstalled); |
| 218 } | 218 } |
| OLD | NEW |