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

Unified Diff: content/browser/host_zoom_map_host.cc

Issue 2374863002: Remove usage of HostZoomMap from c/b/loader via ReadyToCommitNavigation (Closed)
Patch Set: try separate mojom for Associated, crashes on registration Created 4 years, 3 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
Index: content/browser/host_zoom_map_host.cc
diff --git a/content/browser/host_zoom_map_host.cc b/content/browser/host_zoom_map_host.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6b8cc51ed23ab4255f90ab1322110fd9c9c7dbcc
--- /dev/null
+++ b/content/browser/host_zoom_map_host.cc
@@ -0,0 +1,35 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/host_zoom_map_host.h"
+
+#include "content/browser/frame_host/render_frame_host_impl.h"
+#include "content/browser/host_zoom_map_impl.h"
+#include "content/public/browser/navigation_handle.h"
+#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/storage_partition.h"
+#include "content/public/common/associated_interface_provider.h"
+
+namespace content {
+
+HostZoomMapHost::HostZoomMapHost(WebContents* web_contents,
+ RenderFrameHostImpl* render_frame_host_impl)
+ : WebContentsObserver(web_contents),
+ render_frame_host_impl_(render_frame_host_impl) {
+ render_frame_host_impl_->GetRemoteAssociatedInterfaces()->GetInterface(
+ &host_zoom_);
+}
+
+void HostZoomMapHost::ReadyToCommitNavigation(
+ NavigationHandle* navigation_handle) {
+ RenderProcessHost* rph = render_frame_host_impl_->GetProcess();
nasko 2016/09/28 01:32:04 Shouldn't this be done only for the main frame? I
scottmg 2016/09/28 02:44:53 Done.
+ HostZoomMapImpl* host_zoom_map = static_cast<HostZoomMapImpl*>(
+ rph->GetStoragePartition()->GetHostZoomMap());
+ double zoom_level = host_zoom_map->GetZoomLevelForView(
+ navigation_handle->GetURL(), rph->GetID(),
+ render_frame_host_impl_->GetRenderViewHost()->GetRoutingID());
+ host_zoom_->SetHostZoomLevel(navigation_handle->GetURL(), zoom_level);
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698