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

Side by Side Diff: android_webview/native/aw_settings.cc

Issue 944053004: OffscreenPreRaster and its plumbings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « android_webview/native/aw_settings.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // Grab the lock and call UpdateEverythingLocked. 123 // Grab the lock and call UpdateEverythingLocked.
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);
boliu 2015/02/21 00:30:27 UpdateOffscreenPreRasterLocked
hush (inactive) 2015/02/21 00:45:48 Done. Sorry about that./
134 } 134 }
135 135
136 void AwSettings::UpdateUserAgentLocked(JNIEnv* env, jobject obj) { 136 void AwSettings::UpdateUserAgentLocked(JNIEnv* env, jobject obj) {
137 if (!web_contents()) return; 137 if (!web_contents()) return;
138 138
139 ScopedJavaLocalRef<jstring> str = 139 ScopedJavaLocalRef<jstring> str =
140 Java_AwSettings_getUserAgentLocked(env, obj); 140 Java_AwSettings_getUserAgentLocked(env, obj);
141 bool ua_overidden = str.obj() != NULL; 141 bool ua_overidden = str.obj() != NULL;
142 142
143 if (ua_overidden) { 143 if (ua_overidden) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 if (video_overlay != prefs->use_video_overlay_for_embedded_encrypted_video) { 202 if (video_overlay != prefs->use_video_overlay_for_embedded_encrypted_video) {
203 prefs->use_video_overlay_for_embedded_encrypted_video = video_overlay; 203 prefs->use_video_overlay_for_embedded_encrypted_video = video_overlay;
204 update_prefs = true; 204 update_prefs = true;
205 } 205 }
206 206
207 content::RenderViewHost* host = web_contents()->GetRenderViewHost(); 207 content::RenderViewHost* host = web_contents()->GetRenderViewHost();
208 if (update_prefs && host) 208 if (update_prefs && host)
209 host->SyncRendererPrefs(); 209 host->SyncRendererPrefs();
210 } 210 }
211 211
212 void AwSettings::UpdateOffscreenPreRasterLocked(JNIEnv* env, jobject obj) {
213 AwContents* contents = AwContents::FromWebContents(web_contents());
214 if (contents) {
215 contents->SetOffscreenPreRaster(
216 Java_AwSettings_getOffscreenPreRasterLocked(env, obj));
217 }
218 }
219
212 void AwSettings::RenderViewCreated(content::RenderViewHost* render_view_host) { 220 void AwSettings::RenderViewCreated(content::RenderViewHost* render_view_host) {
213 // A single WebContents can normally have 0 to many RenderViewHost instances 221 // A single WebContents can normally have 0 to many RenderViewHost instances
214 // associated with it. 222 // associated with it.
215 // This is important since there is only one RenderViewHostExt instance per 223 // 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 224 // WebContents (and not one RVHExt per RVH, as you might expect) and updating
217 // settings via RVHExt only ever updates the 'current' RVH. 225 // 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 226 // 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 227 // 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 228 // 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. 229 // (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
417 425
418 static jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) { 426 static jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) {
419 return base::android::ConvertUTF8ToJavaString(env, GetUserAgent()).Release(); 427 return base::android::ConvertUTF8ToJavaString(env, GetUserAgent()).Release();
420 } 428 }
421 429
422 bool RegisterAwSettings(JNIEnv* env) { 430 bool RegisterAwSettings(JNIEnv* env) {
423 return RegisterNativesImpl(env); 431 return RegisterNativesImpl(env);
424 } 432 }
425 433
426 } // namespace android_webview 434 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/aw_settings.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698