OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/android/download/items/offline_content_aggregator_facto
ry_android.h" |
| 6 |
| 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/scoped_java_ref.h" |
| 9 #include "chrome/browser/offline_items_collection/offline_content_aggregator_fac
tory.h" |
| 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/profiles/profile_android.h" |
| 12 #include "components/offline_items_collection/core/android/offline_content_aggre
gator_bridge.h" |
| 13 #include "components/offline_items_collection/core/offline_content_aggregator.h" |
| 14 #include "jni/OfflineContentAggregatorFactory_jni.h" |
| 15 |
| 16 using base::android::JavaParamRef; |
| 17 |
| 18 // Takes a Java Profile and returns a Java OfflineContentAggregatorBridge. |
| 19 static base::android::ScopedJavaLocalRef<jobject> |
| 20 GetOfflineContentAggregatorForProfile(JNIEnv* env, |
| 21 const JavaParamRef<jclass>& clazz, |
| 22 const JavaParamRef<jobject>& jprofile) { |
| 23 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); |
| 24 DCHECK(profile); |
| 25 offline_items_collection::OfflineContentAggregator* aggregator = |
| 26 offline_items_collection::OfflineContentAggregatorFactory::GetInstance() |
| 27 ->GetForBrowserContext(profile); |
| 28 return offline_items_collection::android::OfflineContentAggregatorBridge:: |
| 29 GetBridgeForOfflineContentAggregator(aggregator); |
| 30 } |
| 31 |
| 32 bool RegisterOfflineContentAggregatorFactoryJni(JNIEnv* env) { |
| 33 return RegisterNativesImpl(env); |
| 34 } |
OLD | NEW |