blob: b5d82b62f82969102d7e23119d5e78c167ecf5cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/android/warmup_manager.h"
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
#include "chrome/browser/net/predictor.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_android.h"
#include "jni/WarmupManager_jni.h"
#include "url/gurl.h"
static void PreconnectUrlAndSubresources(JNIEnv* env, jclass clazz,
jobject jprofile, jstring url_str) {
if (url_str) {
GURL url = GURL(base::android::ConvertJavaStringToUTF8(env, url_str));
Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile);
if (profile) {
profile->GetNetworkPredictor()->PreconnectUrlAndSubresources(url, GURL());
}
}
}
// Register native methods.
bool RegisterWarmupManager(JNIEnv* env) {
return RegisterNativesImpl(env);
}
|