| 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 #ifndef CHROME_BROWSER_ANDROID_BROWSING_DATA_BROWSING_DATA_COUNTER_BRIDGE_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_BROWSING_DATA_BROWSING_DATA_COUNTER_BRIDGE_H_ |
| 6 #define CHROME_BROWSER_ANDROID_BROWSING_DATA_BROWSING_DATA_COUNTER_BRIDGE_H_ | 6 #define CHROME_BROWSER_ANDROID_BROWSING_DATA_BROWSING_DATA_COUNTER_BRIDGE_H_ |
| 7 | 7 |
| 8 #include "base/android/jni_weak_ref.h" | 8 #include "base/android/jni_weak_ref.h" |
| 9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "components/browsing_data/core/counters/browsing_data_counter.h" | 10 #include "components/browsing_data/core/counters/browsing_data_counter.h" |
| 11 | 11 |
| 12 class Profile; | |
| 13 | |
| 14 // This class is a wrapper for BrowsingDataCounter (C++ backend) to be used by | 12 // This class is a wrapper for BrowsingDataCounter (C++ backend) to be used by |
| 15 // ClearBrowsingDataFragment (Java UI). | 13 // ClearBrowsingDataFragment (Java UI). |
| 16 class BrowsingDataCounterBridge { | 14 class BrowsingDataCounterBridge { |
| 17 public: | 15 public: |
| 18 // Creates a BrowsingDataCounterBridge for a certain browsing data type. | 16 // Creates a BrowsingDataCounterBridge for a certain browsing data type. |
| 19 // The |data_type| is a value of the enum BrowsingDataType. | 17 // The |data_type| is a value of the enum BrowsingDataType. |
| 20 BrowsingDataCounterBridge( | 18 BrowsingDataCounterBridge( |
| 21 JNIEnv* env, | 19 JNIEnv* env, |
| 22 const base::android::JavaParamRef<jobject>& obj, | 20 const base::android::JavaParamRef<jobject>& obj, |
| 23 jint data_type); | 21 jint data_type); |
| 24 | 22 |
| 25 ~BrowsingDataCounterBridge(); | 23 ~BrowsingDataCounterBridge(); |
| 26 | 24 |
| 27 // Called by the Java counterpart when it is getting garbage collected. | 25 // Called by the Java counterpart when it is getting garbage collected. |
| 28 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); | 26 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 29 | 27 |
| 30 static bool Register(JNIEnv* env); | 28 static bool Register(JNIEnv* env); |
| 31 | 29 |
| 32 private: | 30 private: |
| 33 void onCounterFinished( | 31 void onCounterFinished( |
| 34 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result); | 32 std::unique_ptr<browsing_data::BrowsingDataCounter::Result> result); |
| 35 | 33 |
| 36 base::android::ScopedJavaGlobalRef<jobject> jobject_; | 34 base::android::ScopedJavaGlobalRef<jobject> jobject_; |
| 37 std::unique_ptr<browsing_data::BrowsingDataCounter> counter_; | 35 std::unique_ptr<browsing_data::BrowsingDataCounter> counter_; |
| 38 | 36 |
| 39 DISALLOW_COPY_AND_ASSIGN(BrowsingDataCounterBridge); | 37 DISALLOW_COPY_AND_ASSIGN(BrowsingDataCounterBridge); |
| 40 }; | 38 }; |
| 41 | 39 |
| 42 #endif // CHROME_BROWSER_ANDROID_BROWSING_DATA_BROWSING_DATA_COUNTER_BRIDGE_H_ | 40 #endif // CHROME_BROWSER_ANDROID_BROWSING_DATA_BROWSING_DATA_COUNTER_BRIDGE_H_ |
| OLD | NEW |