| OLD | NEW | 
|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/warmup_manager.h" | 5 #include "chrome/browser/android/warmup_manager.h" | 
| 6 | 6 | 
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" | 
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" | 
| 9 #include "chrome/browser/net/predictor.h" | 9 #include "chrome/browser/net/predictor.h" | 
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" | 
| 11 #include "chrome/browser/profiles/profile_android.h" | 11 #include "chrome/browser/profiles/profile_android.h" | 
| 12 #include "jni/WarmupManager_jni.h" | 12 #include "jni/WarmupManager_jni.h" | 
| 13 #include "url/gurl.h" | 13 #include "url/gurl.h" | 
| 14 | 14 | 
|  | 15 using base::android::JavaParamRef; | 
|  | 16 | 
| 15 static void PreconnectUrlAndSubresources(JNIEnv* env, | 17 static void PreconnectUrlAndSubresources(JNIEnv* env, | 
| 16                                          const JavaParamRef<jclass>& clazz, | 18                                          const JavaParamRef<jclass>& clazz, | 
| 17                                          const JavaParamRef<jobject>& jprofile, | 19                                          const JavaParamRef<jobject>& jprofile, | 
| 18                                          const JavaParamRef<jstring>& url_str) { | 20                                          const JavaParamRef<jstring>& url_str) { | 
| 19   if (url_str) { | 21   if (url_str) { | 
| 20     GURL url = GURL(base::android::ConvertJavaStringToUTF8(env, url_str)); | 22     GURL url = GURL(base::android::ConvertJavaStringToUTF8(env, url_str)); | 
| 21     Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); | 23     Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); | 
| 22     if (profile) { | 24     if (profile) { | 
| 23       profile->GetNetworkPredictor()->PreconnectUrlAndSubresources(url, GURL()); | 25       profile->GetNetworkPredictor()->PreconnectUrlAndSubresources(url, GURL()); | 
| 24     } | 26     } | 
| 25   } | 27   } | 
| 26 } | 28 } | 
| 27 | 29 | 
| 28 | 30 | 
| 29 // Register native methods. | 31 // Register native methods. | 
| 30 bool RegisterWarmupManager(JNIEnv* env) { | 32 bool RegisterWarmupManager(JNIEnv* env) { | 
| 31   return RegisterNativesImpl(env); | 33   return RegisterNativesImpl(env); | 
| 32 } | 34 } | 
| OLD | NEW | 
|---|