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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 2211713002: Remove dependency of c/b/loader on c/b/host_zoom_map_impl.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 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
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_impl_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 9fb4467fa3001951d3bbc3694a09ca2bc32629fe..5306018917be9d894dbadbdc7cb3f20a573ba444 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -1256,6 +1256,20 @@ void RenderFrameImpl::InitializeBlameContext(RenderFrameImpl* parent_frame) {
blame_context_->Initialize();
}
+void RenderFrameImpl::OnGotZoomLevel(const GURL& url, double zoom_level) {
+ // TODO(wjmaclean): We should see if this restriction is really necessary,
+ // since it isn't enforced in other parts of the page zoom system (e.g.
+ // when a users changes the zoom of a currently displayed page). Android
+ // has no UI for this, so in theory the following code would normally just use
+ // the default zoom anyways.
+#if !defined(OS_ANDROID)
+ // On Android, page zoom isn't used, and in case of WebView, text zoom is used
+ // for legacy WebView text scaling emulation. Thus, the code that resets
+ // the zoom level from this map will be effectively resetting text zoom level.
+ host_zoom_levels_[url] = zoom_level;
+#endif
+}
+
RenderWidget* RenderFrameImpl::GetRenderWidget() {
RenderFrameImpl* local_root =
RenderFrameImpl::FromWebFrame(frame_->localRoot());
@@ -4136,6 +4150,14 @@ void RenderFrameImpl::willSendRequest(
if (!render_view_->renderer_preferences_.enable_referrers)
request.setHTTPReferrer(WebString(), blink::WebReferrerPolicyDefault);
+
+ if (extra_data->is_main_frame() && RenderThreadImpl::current()) {
+ RenderThreadImpl::current()
+ ->render_frame_message_filter()
+ ->GetHostZoomLevel(render_view_->GetRoutingID(), request_url,
+ base::Bind(&RenderFrameImpl::OnGotZoomLevel,
+ weak_factory_.GetWeakPtr(), request_url));
+ }
}
void RenderFrameImpl::didReceiveResponse(
@@ -4683,7 +4705,7 @@ void RenderFrameImpl::SendDidCommitProvisionalLoad(
// Set zoom level, but don't do it for full-page plugin since they don't use
// the same zoom settings.
HostZoomLevels::iterator host_zoom =
- render_view_->host_zoom_levels_.find(GURL(request.url()));
+ host_zoom_levels_.find(GURL(request.url()));
if (render_view_->webview()->mainFrame()->isWebLocalFrame() &&
render_view_->webview()->mainFrame()->document().isPluginDocument()) {
// Reset the zoom levels for plugins.
@@ -4691,15 +4713,15 @@ void RenderFrameImpl::SendDidCommitProvisionalLoad(
} else {
// If the zoom level is not found, then do nothing. In-page navigation
// relies on not changing the zoom level in this case.
- if (host_zoom != render_view_->host_zoom_levels_.end())
+ if (host_zoom != host_zoom_levels_.end())
render_view_->SetZoomLevel(host_zoom->second);
}
- if (host_zoom != render_view_->host_zoom_levels_.end()) {
+ if (host_zoom != host_zoom_levels_.end()) {
// This zoom level was merely recorded transiently for this load. We can
// erase it now. If at some point we reload this page, the browser will
// send us a new, up-to-date zoom level.
- render_view_->host_zoom_levels_.erase(host_zoom);
+ host_zoom_levels_.erase(host_zoom);
}
// Update contents MIME type for main frame.
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_frame_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698