Chromium Code Reviews| 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..67725f595939639868e0d4fad07ecaeabcab51e0 |
| --- /dev/null |
| +++ b/chrome/browser/android/download/items/offline_content_aggregator_factory_android.cc |
| @@ -0,0 +1,38 @@ |
| +// 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; |
| + |
| +namespace content { |
|
qinmin
2017/03/17 20:50:56
nit: still need this?
David Trainor- moved to gerrit
2017/03/20 05:47:19
Done.
|
| +class BrowserContext; |
| +} // namespace content |
| + |
| +// 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); |
| +} |