Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Side by Side Diff: chrome/browser/android/download/items/offline_content_aggregator_factory_android.cc

Issue 2729983002: Attaches OfflineContentAggregator to Profile (Closed)
Patch Set: Fixed deps issue Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 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.
19 class BrowserContext;
20 } // namespace content
21
22 // Takes a Java Profile and returns a Java OfflineContentAggregatorBridge.
23 static base::android::ScopedJavaLocalRef<jobject>
24 GetOfflineContentAggregatorForProfile(JNIEnv* env,
25 const JavaParamRef<jclass>& clazz,
26 const JavaParamRef<jobject>& jprofile) {
27 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile);
28 DCHECK(profile);
29 offline_items_collection::OfflineContentAggregator* aggregator =
30 offline_items_collection::OfflineContentAggregatorFactory::GetInstance()
31 ->GetForBrowserContext(profile);
32 return offline_items_collection::android::OfflineContentAggregatorBridge::
33 GetBridgeForOfflineContentAggregator(aggregator);
34 }
35
36 bool RegisterOfflineContentAggregatorFactoryJni(JNIEnv* env) {
37 return RegisterNativesImpl(env);
38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698