| Index: chrome/browser/profiles/profile_android.cc
|
| diff --git a/chrome/browser/profiles/profile_android.cc b/chrome/browser/profiles/profile_android.cc
|
| index 71df3812154defc03d445515fb9e2e6afda5b0f3..ddb6024d0976ea749c6c9ee7ad38f48b01297659 100644
|
| --- a/chrome/browser/profiles/profile_android.cc
|
| +++ b/chrome/browser/profiles/profile_android.cc
|
| @@ -5,7 +5,12 @@
|
| #include "chrome/browser/profiles/profile_android.h"
|
|
|
| #include "base/android/jni_android.h"
|
| +#include "base/android/jni_string.h"
|
| +#include "chrome/browser/browser_process.h"
|
| +#include "chrome/browser/prerender/prerender_manager.h"
|
| +#include "chrome/browser/prerender/prerender_manager_factory.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| +#include "chrome/browser/profiles/profile_manager.h"
|
| #include "jni/Profile_jni.h"
|
|
|
| using base::android::AttachCurrentThread;
|
| @@ -29,6 +34,13 @@ ProfileAndroid* ProfileAndroid::FromProfile(Profile* profile) {
|
| }
|
|
|
| // static
|
| +static jint GetDefaultProfile(JNIEnv* env, jclass clazz) {
|
| + ProfileAndroid* default_profile = ProfileAndroid::FromProfile(
|
| + g_browser_process->profile_manager()->GetDefaultProfile());
|
| + return reinterpret_cast<jint>(default_profile);
|
| +}
|
| +
|
| +// static
|
| Profile* ProfileAndroid::FromProfileAndroid(jobject obj) {
|
| if (!obj)
|
| return NULL;
|
| @@ -40,6 +52,26 @@ Profile* ProfileAndroid::FromProfileAndroid(jobject obj) {
|
| return profile_android->profile_;
|
| }
|
|
|
| +bool ProfileAndroid::HasPrerenderedUrl(JNIEnv* env, jobject obj, jstring url) {
|
| + GURL gurl(base::android::ConvertJavaStringToUTF8(env, url));
|
| + prerender::PrerenderManager* prerender_manager =
|
| + prerender::PrerenderManagerFactory::GetForProfile(profile_);
|
| + if (!prerender_manager) return false;
|
| +
|
| + std::vector<content::WebContents*> contents =
|
| + prerender_manager->GetAllPrerenderingContents();
|
| + prerender::PrerenderContents* prerender_contents;
|
| + for (size_t i = 0; i < contents.size(); ++i) {
|
| + prerender_contents = prerender_manager->
|
| + GetPrerenderContents(contents.at(i));
|
| + if (prerender_contents->prerender_url() ==
|
| + gurl && prerender_contents->has_finished_loading()) {
|
| + return true;
|
| + }
|
| + }
|
| + return false;
|
| +}
|
| +
|
| // static
|
| bool ProfileAndroid::RegisterProfileAndroid(JNIEnv* env) {
|
| return RegisterNativesImpl(env);
|
|
|