| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 COMPONENTS_OFFLINE_ITEMS_COLLECTION_CORE_ANDROID_OFFLINE_CONTENT_AGGREGA
TOR_BRIDGE_H_ | 5 #ifndef COMPONENTS_OFFLINE_ITEMS_COLLECTION_CORE_ANDROID_OFFLINE_CONTENT_AGGREGA
TOR_BRIDGE_H_ |
| 6 #define COMPONENTS_OFFLINE_ITEMS_COLLECTION_CORE_ANDROID_OFFLINE_CONTENT_AGGREGA
TOR_BRIDGE_H_ | 6 #define COMPONENTS_OFFLINE_ITEMS_COLLECTION_CORE_ANDROID_OFFLINE_CONTENT_AGGREGA
TOR_BRIDGE_H_ |
| 7 | 7 |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // GetForOfflineContentAggregator() method. | 24 // GetForOfflineContentAggregator() method. |
| 25 // This class creates and contains a strong reference to it's Java counterpart, | 25 // This class creates and contains a strong reference to it's Java counterpart, |
| 26 // so the Java bridge will live as long as this class lives. For more | 26 // so the Java bridge will live as long as this class lives. For more |
| 27 // information on the Java counterpart see OfflineContentAggregatorBridge.java. | 27 // information on the Java counterpart see OfflineContentAggregatorBridge.java. |
| 28 class OfflineContentAggregatorBridge : public OfflineContentProvider::Observer, | 28 class OfflineContentAggregatorBridge : public OfflineContentProvider::Observer, |
| 29 public base::SupportsUserData::Data { | 29 public base::SupportsUserData::Data { |
| 30 public: | 30 public: |
| 31 // Helper method to initialize the JNI hooks between Java and C++. | 31 // Helper method to initialize the JNI hooks between Java and C++. |
| 32 static bool Register(JNIEnv* env); | 32 static bool Register(JNIEnv* env); |
| 33 | 33 |
| 34 // Returns an OfflineContentAggregatorBridge for |aggregator|. There will be | 34 // Returns a Java OfflineContentAggregatorBridge for |aggregator|. There will |
| 35 // only one bridge per OfflineContentAggregator. | 35 // be only one bridge per OfflineContentAggregator. |
| 36 static OfflineContentAggregatorBridge* GetForOfflineContentAggregator( | 36 static base::android::ScopedJavaLocalRef<jobject> |
| 37 OfflineContentAggregator* aggregator); | 37 GetBridgeForOfflineContentAggregator(OfflineContentAggregator* aggregator); |
| 38 | 38 |
| 39 ~OfflineContentAggregatorBridge() override; | 39 ~OfflineContentAggregatorBridge() override; |
| 40 | 40 |
| 41 // Methods called from Java via JNI. | 41 // Methods called from Java via JNI. |
| 42 jboolean AreItemsAvailable(JNIEnv* env, | 42 jboolean AreItemsAvailable(JNIEnv* env, |
| 43 const base::android::JavaParamRef<jobject>& jobj); | 43 const base::android::JavaParamRef<jobject>& jobj); |
| 44 void OpenItem(JNIEnv* env, | 44 void OpenItem(JNIEnv* env, |
| 45 const base::android::JavaParamRef<jobject>& jobj, | 45 const base::android::JavaParamRef<jobject>& jobj, |
| 46 const base::android::JavaParamRef<jstring>& j_namespace, | 46 const base::android::JavaParamRef<jstring>& j_namespace, |
| 47 const base::android::JavaParamRef<jstring>& j_id); | 47 const base::android::JavaParamRef<jstring>& j_id); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 OfflineContentAggregator* const aggregator_; | 87 OfflineContentAggregator* const aggregator_; |
| 88 | 88 |
| 89 DISALLOW_COPY_AND_ASSIGN(OfflineContentAggregatorBridge); | 89 DISALLOW_COPY_AND_ASSIGN(OfflineContentAggregatorBridge); |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 } // namespace android | 92 } // namespace android |
| 93 } // namespace offline_items_collection | 93 } // namespace offline_items_collection |
| 94 | 94 |
| 95 #endif // COMPONENTS_OFFLINE_ITEMS_COLLECTION_CORE_ANDROID_OFFLINE_CONTENT_AGGR
EGATOR_BRIDGE_H_ | 95 #endif // COMPONENTS_OFFLINE_ITEMS_COLLECTION_CORE_ANDROID_OFFLINE_CONTENT_AGGR
EGATOR_BRIDGE_H_ |
| OLD | NEW |