summaryrefslogtreecommitdiffstats
path: root/android_webview/native
diff options
context:
space:
mode:
authorhush <hush@chromium.org>2015-12-17 11:06:40 -0800
committerCommit bot <commit-bot@chromium.org>2015-12-17 19:07:40 +0000
commita695664fb52dc6c631b390aedcc8f27767d6059b (patch)
tree3b97eedcd72e9b202e364cc40a944bfd62a52b56 /android_webview/native
parente78bc2f616abc6be6f9b915bb74b1b7a96d312e2 (diff)
downloadchromium_src-a695664fb52dc6c631b390aedcc8f27767d6059b.zip
chromium_src-a695664fb52dc6c631b390aedcc8f27767d6059b.tar.gz
chromium_src-a695664fb52dc6c631b390aedcc8f27767d6059b.tar.bz2
Apply AwSettings to the current RVH when RVH swaps.
Instead of observing RenderViewCreated, AwSettings observes RenderViewHostChanged. Then the settings will be applied the new currently active RVH. The API on AwRenderViewHostExt should be automatically applied to the currently active RVH, because it sends IPC using the routing ID of the webcontents, which is the routing ID of the current RVH. BUG=533516 Review URL: https://codereview.chromium.org/1498963002 Cr-Commit-Position: refs/heads/master@{#365857}
Diffstat (limited to 'android_webview/native')
-rw-r--r--android_webview/native/aw_settings.cc14
-rw-r--r--android_webview/native/aw_settings.h3
2 files changed, 5 insertions, 12 deletions
diff --git a/android_webview/native/aw_settings.cc b/android_webview/native/aw_settings.cc
index 8817abc..3fae6d4 100644
--- a/android_webview/native/aw_settings.cc
+++ b/android_webview/native/aw_settings.cc
@@ -236,17 +236,9 @@ void AwSettings::UpdateOffscreenPreRasterLocked(
}
}
-void AwSettings::RenderViewCreated(content::RenderViewHost* render_view_host) {
- // A single WebContents can normally have 0 to many RenderViewHost instances
- // associated with it.
- // This is important since there is only one RenderViewHostExt instance per
- // WebContents (and not one RVHExt per RVH, as you might expect) and updating
- // settings via RVHExt only ever updates the 'current' RVH.
- // In android_webview we don't swap out the RVH on cross-site navigations, so
- // we shouldn't have to deal with the multiple RVH per WebContents case. That
- // in turn means that the newly created RVH is always the 'current' RVH
- // (since we only ever go from 0 to 1 RVH instances) and hence the DCHECK.
- DCHECK_EQ(render_view_host, web_contents()->GetRenderViewHost());
+void AwSettings::RenderViewHostChanged(content::RenderViewHost* old_host,
+ content::RenderViewHost* new_host) {
+ DCHECK_EQ(new_host, web_contents()->GetRenderViewHost());
UpdateEverything();
}
diff --git a/android_webview/native/aw_settings.h b/android_webview/native/aw_settings.h
index 79d4f75..8014489 100644
--- a/android_webview/native/aw_settings.h
+++ b/android_webview/native/aw_settings.h
@@ -64,7 +64,8 @@ class AwSettings : public content::WebContentsObserver {
void UpdateEverything();
// WebContentsObserver overrides:
- void RenderViewCreated(content::RenderViewHost* render_view_host) override;
+ void RenderViewHostChanged(content::RenderViewHost* old_host,
+ content::RenderViewHost* new_host) override;
void WebContentsDestroyed() override;
bool renderer_prefs_initialized_;