Chromium Code Reviews| Index: content/renderer/render_frame_impl.cc |
| diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
| index 79bdb6c8e4208d92625cf513e9fa736178563dc3..d1847ff0842b65eeae72eae24f39d14a04239885 100644 |
| --- a/content/renderer/render_frame_impl.cc |
| +++ b/content/renderer/render_frame_impl.cc |
| @@ -1150,6 +1150,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()); |
| @@ -3923,6 +3937,12 @@ void RenderFrameImpl::willSendRequest( |
| if (!render_view_->renderer_preferences_.enable_referrers) |
| request.setHTTPReferrer(WebString(), blink::WebReferrerPolicyDefault); |
| + |
| + if (extra_data->is_main_frame()) { |
| + frame_host_->GetHostZoomLevel(request_url, |
| + base::Bind(&RenderFrameImpl::OnGotZoomLevel, |
| + weak_factory_.GetWeakPtr())); |
|
dcheng
2016/05/18 04:46:17
Why pass the URL through like this? Seems like we
scottmg
2016/05/18 18:31:44
I was sort of thinking of a message protocol where
|
| + } |
| } |
| void RenderFrameImpl::didReceiveResponse( |
| @@ -4522,7 +4542,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. |
| @@ -4530,15 +4550,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. |
| @@ -6019,6 +6039,8 @@ void RenderFrameImpl::RegisterMojoServices() { |
| GetServiceRegistry()->AddService(base::Bind( |
| &ImageDownloaderImpl::CreateMojoService, base::Unretained(this))); |
| } |
| + |
| + GetServiceRegistry()->ConnectToRemoteService(mojo::GetProxy(&frame_host_)); |
| } |
| template <typename Interface> |