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