Index: chrome/browser/android/download/items/offline_content_aggregator_factory_android.cc |
diff --git a/chrome/browser/android/download/items/offline_content_aggregator_factory_android.cc b/chrome/browser/android/download/items/offline_content_aggregator_factory_android.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4cb9409971954b719b68a70e6bde550ff6875722 |
--- /dev/null |
+++ b/chrome/browser/android/download/items/offline_content_aggregator_factory_android.cc |
@@ -0,0 +1,34 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/android/download/items/offline_content_aggregator_factory_android.h" |
+ |
+#include "base/android/jni_android.h" |
+#include "base/android/scoped_java_ref.h" |
+#include "chrome/browser/offline_items_collection/offline_content_aggregator_factory.h" |
+#include "chrome/browser/profiles/profile.h" |
+#include "chrome/browser/profiles/profile_android.h" |
+#include "components/offline_items_collection/core/android/offline_content_aggregator_bridge.h" |
+#include "components/offline_items_collection/core/offline_content_aggregator.h" |
+#include "jni/OfflineContentAggregatorFactory_jni.h" |
+ |
+using base::android::JavaParamRef; |
+ |
+// Takes a Java Profile and returns a Java OfflineContentAggregatorBridge. |
+static base::android::ScopedJavaLocalRef<jobject> |
+GetOfflineContentAggregatorForProfile(JNIEnv* env, |
+ const JavaParamRef<jclass>& clazz, |
+ const JavaParamRef<jobject>& jprofile) { |
+ Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); |
+ DCHECK(profile); |
+ offline_items_collection::OfflineContentAggregator* aggregator = |
+ offline_items_collection::OfflineContentAggregatorFactory::GetInstance() |
+ ->GetForBrowserContext(profile); |
+ return offline_items_collection::android::OfflineContentAggregatorBridge:: |
+ GetBridgeForOfflineContentAggregator(aggregator); |
+} |
+ |
+bool RegisterOfflineContentAggregatorFactoryJni(JNIEnv* env) { |
+ return RegisterNativesImpl(env); |
+} |