OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 org.chromium.base.annotations.CalledByNative; | 7 import org.chromium.base.annotations.CalledByNative; |
8 | 8 |
9 /** | 9 /** |
10 * Communicates between BrowsingDataCounter (C++ backend) and ClearBrowsingDataF
ragment (Java UI). | 10 * Communicates between BrowsingDataCounter (C++ backend) and ClearBrowsingDataF
ragment (Java UI). |
(...skipping 11 matching lines...) Expand all Loading... |
22 public void onCounterFinished(String result); | 22 public void onCounterFinished(String result); |
23 } | 23 } |
24 | 24 |
25 private long mNativeBrowsingDataCounterBridge; | 25 private long mNativeBrowsingDataCounterBridge; |
26 private BrowsingDataCounterCallback mCallback; | 26 private BrowsingDataCounterCallback mCallback; |
27 | 27 |
28 /** | 28 /** |
29 * Initializes BrowsingDataCounterBridge. | 29 * Initializes BrowsingDataCounterBridge. |
30 * @param callback A callback to call with the result when the counter finis
hes. | 30 * @param callback A callback to call with the result when the counter finis
hes. |
31 * @param dataType The browsing data type to be counted (from the shared enu
m | 31 * @param dataType The browsing data type to be counted (from the shared enu
m |
32 * {@link org.chromium.chrome.browser.browsing_data.BrowsingDataType}). | 32 * @param prefType The type of preference that should be handled (Default, B
asic or Advanced |
| 33 * from {@link org.chromium.chrome.browser.browsing_data.ClearBrowsingDa
taTab}). |
33 */ | 34 */ |
34 public BrowsingDataCounterBridge(BrowsingDataCounterCallback callback, int d
ataType) { | 35 public BrowsingDataCounterBridge( |
| 36 BrowsingDataCounterCallback callback, int dataType, int prefType) { |
35 mCallback = callback; | 37 mCallback = callback; |
36 mNativeBrowsingDataCounterBridge = nativeInit(dataType); | 38 mNativeBrowsingDataCounterBridge = nativeInit(dataType, prefType); |
37 } | 39 } |
38 | 40 |
39 /** | 41 /** |
40 * Destroys the native counterpart of this class. | 42 * Destroys the native counterpart of this class. |
41 */ | 43 */ |
42 public void destroy() { | 44 public void destroy() { |
43 if (mNativeBrowsingDataCounterBridge != 0) { | 45 if (mNativeBrowsingDataCounterBridge != 0) { |
44 nativeDestroy(mNativeBrowsingDataCounterBridge); | 46 nativeDestroy(mNativeBrowsingDataCounterBridge); |
45 mNativeBrowsingDataCounterBridge = 0; | 47 mNativeBrowsingDataCounterBridge = 0; |
46 } | 48 } |
47 } | 49 } |
48 | 50 |
49 @CalledByNative | 51 @CalledByNative |
50 private void onBrowsingDataCounterFinished(String result) { | 52 private void onBrowsingDataCounterFinished(String result) { |
51 mCallback.onCounterFinished(result); | 53 mCallback.onCounterFinished(result); |
52 } | 54 } |
53 | 55 |
54 private native long nativeInit(int dataType); | 56 private native long nativeInit(int dataType, int prefType); |
55 private native void nativeDestroy(long nativeBrowsingDataCounterBridge); | 57 private native void nativeDestroy(long nativeBrowsingDataCounterBridge); |
56 } | 58 } |
OLD | NEW |