Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/browser/host_zoom_map_host.h" | |
| 6 | |
| 7 #include "content/browser/frame_host/render_frame_host_impl.h" | |
| 8 #include "content/browser/host_zoom_map_impl.h" | |
| 9 #include "content/public/browser/navigation_handle.h" | |
| 10 #include "content/public/browser/render_view_host.h" | |
| 11 #include "content/public/browser/storage_partition.h" | |
| 12 #include "content/public/common/associated_interface_provider.h" | |
| 13 | |
| 14 namespace content { | |
| 15 | |
| 16 HostZoomMapHost::HostZoomMapHost(WebContents* web_contents, | |
| 17 RenderFrameHostImpl* render_frame_host_impl) | |
| 18 : WebContentsObserver(web_contents), | |
| 19 render_frame_host_impl_(render_frame_host_impl) { | |
| 20 render_frame_host_impl_->GetRemoteAssociatedInterfaces()->GetInterface( | |
| 21 &host_zoom_); | |
| 22 } | |
| 23 | |
| 24 void HostZoomMapHost::ReadyToCommitNavigation( | |
| 25 NavigationHandle* navigation_handle) { | |
| 26 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.
| |
| 27 HostZoomMapImpl* host_zoom_map = static_cast<HostZoomMapImpl*>( | |
| 28 rph->GetStoragePartition()->GetHostZoomMap()); | |
| 29 double zoom_level = host_zoom_map->GetZoomLevelForView( | |
| 30 navigation_handle->GetURL(), rph->GetID(), | |
| 31 render_frame_host_impl_->GetRenderViewHost()->GetRoutingID()); | |
| 32 host_zoom_->SetHostZoomLevel(navigation_handle->GetURL(), zoom_level); | |
| 33 } | |
| 34 | |
| 35 } // namespace content | |
| OLD | NEW |