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

Unified Diff: chrome/browser/profiles/profile_android.cc

Issue 11473027: [Android] Should not update IME status when gesture needs to be disambiguated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add prerendering utilities to profile_android Created 7 years, 4 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 | « chrome/browser/profiles/profile_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « chrome/browser/profiles/profile_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698