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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 1964273002: Add FrameHost mojo service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 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 61a3eb8bdd5999c0ac2d555c736e6ca97137cfe4..75034cd58065ee5e33c8c9facbd59ffb8dd7d43e 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -1181,6 +1181,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());
@@ -3951,6 +3965,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(), request_url));
+ }
}
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.
@@ -6016,6 +6036,8 @@ void RenderFrameImpl::RegisterMojoServices() {
GetServiceRegistry()->AddService(base::Bind(
&ImageDownloaderImpl::CreateMojoService, base::Unretained(this)));
}
+
+ GetServiceRegistry()->ConnectToRemoteService(mojo::GetProxy(&frame_host_));
}
template <typename Interface>
« 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