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