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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 void AwSettings::RenderViewCreated(content::RenderViewHost* render_view_host) { | 255 void AwSettings::RenderViewCreated(content::RenderViewHost* render_view_host) { |
256 // A single WebContents can normally have 0 to many RenderViewHost instances | 256 // A single WebContents can normally have 0 to many RenderViewHost instances |
257 // associated with it. | 257 // associated with it. |
258 // This is important since there is only one RenderViewHostExt instance per | 258 // This is important since there is only one RenderViewHostExt instance per |
259 // WebContents (and not one RVHExt per RVH, as you might expect) and updating | 259 // WebContents (and not one RVHExt per RVH, as you might expect) and updating |
260 // settings via RVHExt only ever updates the 'current' RVH. | 260 // settings via RVHExt only ever updates the 'current' RVH. |
261 // In android_webview we don't swap out the RVH on cross-site navigations, so | 261 // In android_webview we don't swap out the RVH on cross-site navigations, so |
262 // we shouldn't have to deal with the multiple RVH per WebContents case. That | 262 // we shouldn't have to deal with the multiple RVH per WebContents case. That |
263 // in turn means that the newly created RVH is always the 'current' RVH | 263 // in turn means that the newly created RVH is always the 'current' RVH |
264 // (since we only ever go from 0 to 1 RVH instances) and hence the DCHECK. | 264 // (since we only ever go from 0 to 1 RVH instances) and hence the DCHECK. |
265 DCHECK(web_contents()->GetRenderViewHost() == render_view_host); | 265 DCHECK_EQ(render_view_host, web_contents()->GetRenderViewHost()); |
266 | 266 |
267 UpdateEverything(); | 267 UpdateEverything(); |
268 } | 268 } |
269 | 269 |
270 void AwSettings::WebContentsDestroyed() { | 270 void AwSettings::WebContentsDestroyed() { |
271 delete this; | 271 delete this; |
272 } | 272 } |
273 | 273 |
274 void AwSettings::PopulateWebPreferences(WebPreferences* web_prefs) { | 274 void AwSettings::PopulateWebPreferences(WebPreferences* web_prefs) { |
275 JNIEnv* env = base::android::AttachCurrentThread(); | 275 JNIEnv* env = base::android::AttachCurrentThread(); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 | 439 |
440 static jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) { | 440 static jstring GetDefaultUserAgent(JNIEnv* env, jclass clazz) { |
441 return base::android::ConvertUTF8ToJavaString(env, GetUserAgent()).Release(); | 441 return base::android::ConvertUTF8ToJavaString(env, GetUserAgent()).Release(); |
442 } | 442 } |
443 | 443 |
444 bool RegisterAwSettings(JNIEnv* env) { | 444 bool RegisterAwSettings(JNIEnv* env) { |
445 return RegisterNativesImpl(env); | 445 return RegisterNativesImpl(env); |
446 } | 446 } |
447 | 447 |
448 } // namespace android_webview | 448 } // namespace android_webview |
OLD | NEW |