summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/ContentViewUtil.java13
-rw-r--r--chrome/browser/android/content_view_util.cc9
-rw-r--r--content/browser/renderer_host/render_widget_host_view_android.cc2
3 files changed, 17 insertions, 7 deletions
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ContentViewUtil.java b/chrome/android/java/src/org/chromium/chrome/browser/ContentViewUtil.java
index 69edb29..ce0bb68 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ContentViewUtil.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ContentViewUtil.java
@@ -18,7 +18,15 @@ public abstract class ContentViewUtil {
* (java) ContentViewCore instance.
*/
public static long createNativeWebContents(boolean incognito) {
- return nativeCreateNativeWebContents(incognito);
+ return nativeCreateNativeWebContents(incognito, false);
+ }
+
+ /**
+ * @return pointer to native WebContents instance, suitable for using with a
+ * (java) ContentViewCore instance.
+ */
+ public static long createNativeWebContents(boolean incognito, boolean initiallyHidden) {
+ return nativeCreateNativeWebContents(incognito, initiallyHidden);
}
/**
@@ -28,6 +36,7 @@ public abstract class ContentViewUtil {
nativeDestroyNativeWebContents(webContentsPtr);
}
- private static native long nativeCreateNativeWebContents(boolean incognito);
+ private static native long nativeCreateNativeWebContents(boolean incognito,
+ boolean initiallyHidden);
private static native void nativeDestroyNativeWebContents(long webContentsPtr);
}
diff --git a/chrome/browser/android/content_view_util.cc b/chrome/browser/android/content_view_util.cc
index 95ab743..f4338fc 100644
--- a/chrome/browser/android/content_view_util.cc
+++ b/chrome/browser/android/content_view_util.cc
@@ -12,14 +12,15 @@
#include "jni/ContentViewUtil_jni.h"
static jlong CreateNativeWebContents(
- JNIEnv* env, jclass clazz, jboolean incognito) {
+ JNIEnv* env, jclass clazz, jboolean incognito, jboolean initially_hidden) {
Profile* profile = g_browser_process->profile_manager()->GetLastUsedProfile();
if (incognito)
profile = profile->GetOffTheRecordProfile();
- content::WebContents* web_contents =
- content::WebContents::Create(content::WebContents::CreateParams(profile));
- return reinterpret_cast<intptr_t>(web_contents);
+ content::WebContents::CreateParams params =
+ content::WebContents::CreateParams(profile);
+ params.initially_hidden = static_cast<bool>(initially_hidden);
+ return reinterpret_cast<intptr_t>(content::WebContents::Create(params));
}
static void DestroyNativeWebContents(
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index 171bacf..3df0b11 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -109,7 +109,7 @@ RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid(
ContentViewCoreImpl* content_view_core)
: host_(widget_host),
needs_begin_frame_(false),
- are_layers_attached_(true),
+ are_layers_attached_(!widget_host->is_hidden()),
content_view_core_(NULL),
ime_adapter_android_(this),
cached_background_color_(SK_ColorWHITE),