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

Unified Diff: content/browser/host_zoom_map_observer.cc

Issue 2374863002: Remove usage of HostZoomMap from c/b/loader via ReadyToCommitNavigation (Closed)
Patch Set: init Created 4 years, 2 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/browser/host_zoom_map_observer.h ('k') | content/browser/loader/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/host_zoom_map_observer.cc
diff --git a/content/browser/host_zoom_map_observer.cc b/content/browser/host_zoom_map_observer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..88d42dfb6b825f27965b4206b8cf3f5e40ddb139
--- /dev/null
+++ b/content/browser/host_zoom_map_observer.cc
@@ -0,0 +1,45 @@
+// 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_observer.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 {
+
+HostZoomMapObserver::HostZoomMapObserver(WebContents* web_contents)
+ : WebContentsObserver(web_contents) {}
+
+HostZoomMapObserver::~HostZoomMapObserver() {}
+
+void HostZoomMapObserver::ReadyToCommitNavigation(
+ NavigationHandle* navigation_handle) {
+ if (!navigation_handle->IsInMainFrame())
+ return;
+
+ DCHECK(host_zoom_.is_bound());
+ if (!host_zoom_.is_bound())
+ return;
+
+ RenderFrameHost* render_frame_host =
+ navigation_handle->GetRenderFrameHost();
+ RenderProcessHost* render_process_host = render_frame_host->GetProcess();
+ HostZoomMapImpl* host_zoom_map = static_cast<HostZoomMapImpl*>(
+ render_process_host->GetStoragePartition()->GetHostZoomMap());
+ double zoom_level = host_zoom_map->GetZoomLevelForView(
+ navigation_handle->GetURL(), render_process_host->GetID(),
+ render_frame_host->GetRenderViewHost()->GetRoutingID());
+ host_zoom_->SetHostZoomLevel(navigation_handle->GetURL(), zoom_level);
+}
+
+void HostZoomMapObserver::RenderFrameCreated(RenderFrameHost* rfh) {
+ rfh->GetRemoteAssociatedInterfaces()->GetInterface(&host_zoom_);
+}
+
+} // namespace content
« no previous file with comments | « content/browser/host_zoom_map_observer.h ('k') | content/browser/loader/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698