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

Unified Diff: chrome/browser/android/precache/precache_launcher.cc

Issue 1176253002: Fix IsPrecachingAllowed() to check Sync instead of Data Saver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweaks per bengr. Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/net/chrome_network_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/precache/precache_launcher.cc
diff --git a/chrome/browser/android/precache/precache_launcher.cc b/chrome/browser/android/precache/precache_launcher.cc
index 4924cd5ca31a302fedb296519ac5cf270301997b..6b89d59570afe2aa066f298253cebcb0f0b2711c 100644
--- a/chrome/browser/android/precache/precache_launcher.cc
+++ b/chrome/browser/android/precache/precache_launcher.cc
@@ -13,13 +13,11 @@
#include "base/prefs/pref_service.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/history/history_service_factory.h"
+#include "chrome/browser/precache/precache_manager_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/browser/sync/profile_sync_service.h"
-#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "components/keyed_service/core/service_access_type.h"
#include "components/precache/content/precache_manager.h"
-#include "components/precache/content/precache_manager_factory.h"
#include "jni/PrecacheLauncher_jni.h"
using base::android::AttachCurrentThread;
@@ -48,12 +46,6 @@ PrecacheManager* GetPrecacheManager(Profile* profile) {
return precache_manager;
}
-bool IsSyncTabsEnabled(Profile* profile) {
- ProfileSyncService* sync = ProfileSyncServiceFactory::GetForProfile(profile);
- return sync->CanSyncStart() &&
- sync->GetPreferredDataTypes().Has(syncer::PROXY_TABS);
-}
-
} // namespace
PrecacheLauncher::PrecacheLauncher(JNIEnv* env, jobject obj)
@@ -68,12 +60,13 @@ void PrecacheLauncher::Destroy(JNIEnv* env, jobject obj) {
void PrecacheLauncher::Start(JNIEnv* env, jobject obj) {
// TODO(bengr): Add integration tests for the whole feature.
Profile* profile = GetProfile();
- PrecacheManager* precache_manager = GetPrecacheManager(profile);
+ PrecacheManager* precache_manager = GetPrecacheManager(profile);
history::HistoryService* hs = HistoryServiceFactory::GetForProfile(
profile, ServiceAccessType::IMPLICIT_ACCESS);
- if (hs == nullptr || !IsSyncTabsEnabled(profile)) {
+ if (precache_manager == nullptr || hs == nullptr ||
+ !precache_manager->IsPrecachingAllowed()) {
Java_PrecacheLauncher_onPrecacheCompletedCallback(
env, weak_java_precache_launcher_.get(env).obj());
return;
« no previous file with comments | « no previous file | chrome/browser/net/chrome_network_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698