OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/android/precache/precache_launcher.h" | 5 #include "chrome/browser/android/precache/precache_launcher.h" |
6 | 6 |
7 #include <jni.h> | 7 #include <jni.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_weak_ref.h" | 10 #include "base/android/jni_weak_ref.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // Get the PrecacheManager for the given |profile|. | 43 // Get the PrecacheManager for the given |profile|. |
44 PrecacheManager* GetPrecacheManager(Profile* profile) { | 44 PrecacheManager* GetPrecacheManager(Profile* profile) { |
45 PrecacheManager* precache_manager = | 45 PrecacheManager* precache_manager = |
46 precache::PrecacheManagerFactory::GetForBrowserContext(profile); | 46 precache::PrecacheManagerFactory::GetForBrowserContext(profile); |
47 DCHECK(precache_manager); | 47 DCHECK(precache_manager); |
48 return precache_manager; | 48 return precache_manager; |
49 } | 49 } |
50 | 50 |
51 bool IsSyncTabsEnabled(Profile* profile) { | 51 bool IsSyncTabsEnabled(Profile* profile) { |
52 ProfileSyncService* sync = ProfileSyncServiceFactory::GetForProfile(profile); | 52 ProfileSyncService* sync = ProfileSyncServiceFactory::GetForProfile(profile); |
53 return sync->IsSyncEnabledAndLoggedIn() && | 53 return sync->CanSyncStart() && |
54 sync->GetPreferredDataTypes().Has(syncer::PROXY_TABS); | 54 sync->GetPreferredDataTypes().Has(syncer::PROXY_TABS); |
55 } | 55 } |
56 | 56 |
57 } // namespace | 57 } // namespace |
58 | 58 |
59 PrecacheLauncher::PrecacheLauncher(JNIEnv* env, jobject obj) | 59 PrecacheLauncher::PrecacheLauncher(JNIEnv* env, jobject obj) |
60 : weak_java_precache_launcher_(env, obj), weak_factory_(this) {} | 60 : weak_java_precache_launcher_(env, obj), weak_factory_(this) {} |
61 | 61 |
62 PrecacheLauncher::~PrecacheLauncher() {} | 62 PrecacheLauncher::~PrecacheLauncher() {} |
63 | 63 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 return reinterpret_cast<intptr_t>(new PrecacheLauncher(env, obj)); | 102 return reinterpret_cast<intptr_t>(new PrecacheLauncher(env, obj)); |
103 } | 103 } |
104 | 104 |
105 static jboolean IsPrecachingEnabled(JNIEnv* env, jclass clazz) { | 105 static jboolean IsPrecachingEnabled(JNIEnv* env, jclass clazz) { |
106 return PrecacheManager::IsPrecachingEnabled(); | 106 return PrecacheManager::IsPrecachingEnabled(); |
107 } | 107 } |
108 | 108 |
109 bool RegisterPrecacheLauncher(JNIEnv* env) { | 109 bool RegisterPrecacheLauncher(JNIEnv* env) { |
110 return RegisterNativesImpl(env); | 110 return RegisterNativesImpl(env); |
111 } | 111 } |
OLD | NEW |