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

Unified Diff: android_webview/native/aw_settings.cc

Issue 12567020: [android] Resize the android_webview if it's 0x0 initially. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
Index: android_webview/native/aw_settings.cc
diff --git a/android_webview/native/aw_settings.cc b/android_webview/native/aw_settings.cc
index ef10859c229cad7d911ca1003a28c147fa47e098..65277485b9c5cc3a799e746d9b3bf695136bfc7c 100644
--- a/android_webview/native/aw_settings.cc
+++ b/android_webview/native/aw_settings.cc
@@ -6,6 +6,8 @@
#include "android_webview/browser/renderer_host/aw_render_view_host_ext.h"
#include "android_webview/native/aw_contents.h"
+#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/web_contents.h"
#include "jni/AwSettings_jni.h"
#include "webkit/glue/webkit_glue.h"
@@ -58,10 +60,16 @@ void AwSettings::SetTextZoom(JNIEnv* env, jobject obj, jint text_zoom_percent) {
UpdateTextZoom();
}
-void AwSettings::SetWebContents(JNIEnv* env, jobject obj, jint web_contents) {
- Observe(reinterpret_cast<content::WebContents*>(web_contents));
-}
+void AwSettings::SetWebContents(JNIEnv* env, jobject obj, jint jweb_contents) {
+ content::WebContents* web_contents =
+ reinterpret_cast<content::WebContents*>(jweb_contents);
+ Observe(web_contents);
+ content::RenderViewHost* rvh = web_contents->GetRenderViewHost();
+ if (rvh) {
+ rvh->EnablePreferredSizeMode();
+ }
+}
void AwSettings::UpdateEnableFixedLayoutMode() {
AwRenderViewHostExt* rvhe = GetAwRenderViewHostExt();
@@ -95,6 +103,7 @@ void AwSettings::RenderViewCreated(content::RenderViewHost* render_view_host) {
UpdateEnableFixedLayoutMode();
UpdateInitialPageScale();
UpdateTextZoom();
+ render_view_host->EnablePreferredSizeMode();
joth 2013/03/26 22:12:49 for consistency I wonder about having UpdatePrefer
mnaganov (inactive) 2013/03/27 11:06:31 Yes, a good point! I have completely missed the po
}
static jint Init(JNIEnv* env,

Powered by Google App Engine
This is Rietveld 408576698