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" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/prefs/pref_service.h" | |
14 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/precache/precache_manager_factory.h" | 14 #include "chrome/browser/precache/precache_manager_factory.h" |
16 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
18 #include "components/precache/content/precache_manager.h" | 17 #include "components/precache/content/precache_manager.h" |
| 18 #include "components/prefs/pref_service.h" |
19 #include "jni/PrecacheLauncher_jni.h" | 19 #include "jni/PrecacheLauncher_jni.h" |
20 | 20 |
21 using base::android::AttachCurrentThread; | 21 using base::android::AttachCurrentThread; |
22 using precache::PrecacheManager; | 22 using precache::PrecacheManager; |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // Get the profile that should be used for precaching. | 26 // Get the profile that should be used for precaching. |
27 Profile* GetProfile() { | 27 Profile* GetProfile() { |
28 Profile* profile = g_browser_process->profile_manager()->GetLastUsedProfile() | 28 Profile* profile = g_browser_process->profile_manager()->GetLastUsedProfile() |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 static jboolean ShouldRun(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 88 static jboolean ShouldRun(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
89 Profile* profile = GetProfile(); | 89 Profile* profile = GetProfile(); |
90 PrecacheManager* precache_manager = GetPrecacheManager(profile); | 90 PrecacheManager* precache_manager = GetPrecacheManager(profile); |
91 return precache_manager && (precache_manager->IsInExperimentGroup() || | 91 return precache_manager && (precache_manager->IsInExperimentGroup() || |
92 precache_manager->IsInControlGroup()); | 92 precache_manager->IsInControlGroup()); |
93 } | 93 } |
94 | 94 |
95 bool RegisterPrecacheLauncher(JNIEnv* env) { | 95 bool RegisterPrecacheLauncher(JNIEnv* env) { |
96 return RegisterNativesImpl(env); | 96 return RegisterNativesImpl(env); |
97 } | 97 } |
OLD | NEW |