Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/datausage/ExternalDataUseObserver.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/datausage/ExternalDataUseObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/datausage/ExternalDataUseObserver.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ff42d5ee9556289c2ce282915d123ae431b2483e |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/datausage/ExternalDataUseObserver.java |
| @@ -0,0 +1,46 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.chrome.browser.datausage; |
| + |
| +import android.content.Context; |
| + |
| +import org.chromium.base.annotations.CalledByNative; |
| +import org.chromium.base.annotations.JNINamespace; |
| +import org.chromium.chrome.browser.ChromeApplication; |
| + |
| +/** |
| + * This class provides a base class implementation of a data use observer that is external to |
| + * Chromium. This class should be accessed only on IO thread. |
| + */ |
| +@JNINamespace("chrome::android") |
| +public class ExternalDataUseObserver { |
| + /** |
| + * Pointer to the native ExternalDataUseObserver object. |
| + */ |
| + private long mNativeExternalDataUseObserver; |
| + |
| + @CalledByNative |
| + private static ExternalDataUseObserver create(Context context, long nativePtr) { |
| + return ((ChromeApplication) context).createExternalDataUseObserver(nativePtr); |
| + } |
| + |
| + /* |
|
newt (away)
2015/10/14 00:02:48
nit: use two asterisks "**"
tbansal1
2015/10/14 00:37:15
Done.
|
| + * Notification that the native object has been destroyed. |
| + */ |
| + @CalledByNative |
| + private void onDestroy() { |
| + mNativeExternalDataUseObserver = 0; |
| + } |
| + |
| + @CalledByNative |
| + private void onDataUse(String tag, long bytesDownloaded, long bytesUploaded) {} |
| + |
| + /** |
| + * Creates an instance of {@link #ExternalDataUseObserver}. |
| + */ |
| + public ExternalDataUseObserver(long nativePtr) { |
| + mNativeExternalDataUseObserver = nativePtr; |
| + } |
| +} |