OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "android_webview/native/aw_settings.h" | 5 #include "android_webview/native/aw_settings.h" |
6 | 6 |
7 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" | 7 #include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" |
8 #include "android_webview/common/aw_content_client.h" | 8 #include "android_webview/common/aw_content_client.h" |
9 #include "android_webview/native/aw_contents.h" | 9 #include "android_webview/native/aw_contents.h" |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 Java_AwSettings_updateEverything(env, obj); | 124 Java_AwSettings_updateEverything(env, obj); |
125 } | 125 } |
126 | 126 |
127 void AwSettings::UpdateEverythingLocked(JNIEnv* env, jobject obj) { | 127 void AwSettings::UpdateEverythingLocked(JNIEnv* env, jobject obj) { |
128 UpdateInitialPageScaleLocked(env, obj); | 128 UpdateInitialPageScaleLocked(env, obj); |
129 UpdateWebkitPreferencesLocked(env, obj); | 129 UpdateWebkitPreferencesLocked(env, obj); |
130 UpdateUserAgentLocked(env, obj); | 130 UpdateUserAgentLocked(env, obj); |
131 ResetScrollAndScaleState(env, obj); | 131 ResetScrollAndScaleState(env, obj); |
132 UpdateFormDataPreferencesLocked(env, obj); | 132 UpdateFormDataPreferencesLocked(env, obj); |
133 UpdateRendererPreferencesLocked(env, obj); | 133 UpdateRendererPreferencesLocked(env, obj); |
| 134 UpdateOffscreenPreRasterLocked(env, obj); |
134 } | 135 } |
135 | 136 |
136 void AwSettings::UpdateUserAgentLocked(JNIEnv* env, jobject obj) { | 137 void AwSettings::UpdateUserAgentLocked(JNIEnv* env, jobject obj) { |
137 if (!web_contents()) return; | 138 if (!web_contents()) return; |
138 | 139 |
139 ScopedJavaLocalRef<jstring> str = | 140 ScopedJavaLocalRef<jstring> str = |
140 Java_AwSettings_getUserAgentLocked(env, obj); | 141 Java_AwSettings_getUserAgentLocked(env, obj); |
141 bool ua_overidden = str.obj() != NULL; | 142 bool ua_overidden = str.obj() != NULL; |
142 | 143 |
143 if (ua_overidden) { | 144 if (ua_overidden) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 if (video_overlay != prefs->use_video_overlay_for_embedded_encrypted_video) { | 203 if (video_overlay != prefs->use_video_overlay_for_embedded_encrypted_video) { |
203 prefs->use_video_overlay_for_embedded_encrypted_video = video_overlay; | 204 prefs->use_video_overlay_for_embedded_encrypted_video = video_overlay; |
204 update_prefs = true; | 205 update_prefs = true; |
205 } | 206 } |
206 | 207 |
207 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); | 208 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); |
208 if (update_prefs && host) | 209 if (update_prefs && host) |
209 host->SyncRendererPrefs(); | 210 host->SyncRendererPrefs(); |
210 } | 211 } |
211 | 212 |
| 213 void AwSettings::UpdateOffscreenPreRasterLocked(JNIEnv* env, jobject obj) { |
| 214 AwContents* contents = AwContents::FromWebContents(web_contents()); |
| 215 if (contents) { |
| 216 contents->SetOffscreenPreRaster( |
| 217 Java_AwSettings_getOffscreenPreRasterLocked(env, obj)); |
| 218 } |
| 219 } |
| 220 |
212 void AwSettings::RenderViewCreated(content::RenderViewHost* render_view_host) { | 221 void AwSettings::RenderViewCreated(content::RenderViewHost* render_view_host) { |
213 // A single WebContents can normally have 0 to many RenderViewHost instances | 222 // A single WebContents can normally have 0 to many RenderViewHost instances |
214 // associated with it. | 223 // associated with it. |
215 // This is important since there is only one RenderViewHostExt instance per | 224 // This is important since there is only one RenderViewHostExt instance per |
216 // WebContents (and not one RVHExt per RVH, as you might expect) and updating | 225 // WebContents (and not one RVHExt per RVH, as you might expect) and updating |
217 // settings via RVHExt only ever updates the 'current' RVH. | 226 // settings via RVHExt only ever updates the 'current' RVH. |
218 // In android_webview we don't swap out the RVH on cross-site navigations, so | 227 // In android_webview we don't swap out the RVH on cross-site navigations, so |
219 // we shouldn't have to deal with the multiple RVH per WebContents case. That | 228 // we shouldn't have to deal with the multiple RVH per WebContents case. That |
220 // in turn means that the newly created RVH is always the 'current' RVH | 229 // in turn means that the newly created RVH is always the 'current' RVH |
221 // (since we only ever go from 0 to 1 RVH instances) and hence the DCHECK. | 230 // (since we only ever go from 0 to 1 RVH instances) and hence the DCHECK. |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 426 |
418 static jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) { | 427 static jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) { |
419 return base::android::ConvertUTF8ToJavaString(env, GetUserAgent()).Release(); | 428 return base::android::ConvertUTF8ToJavaString(env, GetUserAgent()).Release(); |
420 } | 429 } |
421 | 430 |
422 bool RegisterAwSettings(JNIEnv* env) { | 431 bool RegisterAwSettings(JNIEnv* env) { |
423 return RegisterNativesImpl(env); | 432 return RegisterNativesImpl(env); |
424 } | 433 } |
425 | 434 |
426 } // namespace android_webview | 435 } // namespace android_webview |
OLD | NEW |