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

Side by Side Diff: content/browser/host_zoom_map_observer.cc

Issue 2374863002: Remove usage of HostZoomMap from c/b/loader via ReadyToCommitNavigation (Closed)
Patch Set: android 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 unified diff | Download patch
OLDNEW
(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_observer.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 DEFINE_WEB_CONTENTS_USER_DATA_KEY(HostZoomMapObserver);
17
18 HostZoomMapObserver::HostZoomMapObserver(WebContents* web_contents)
19 : WebContentsObserver(web_contents) {}
20
21 HostZoomMapObserver::~HostZoomMapObserver() {}
22
23 void HostZoomMapObserver::ReadyToCommitNavigation(
24 NavigationHandle* navigation_handle) {
25 if (navigation_handle->IsInMainFrame()) {
26 if (host_zoom_.is_bound()) {
27 RenderFrameHost* render_frame_host =
28 navigation_handle->GetRenderFrameHost();
29 RenderProcessHost* render_process_host = render_frame_host->GetProcess();
30 HostZoomMapImpl* host_zoom_map = static_cast<HostZoomMapImpl*>(
31 render_process_host->GetStoragePartition()->GetHostZoomMap());
32 double zoom_level = host_zoom_map->GetZoomLevelForView(
33 navigation_handle->GetURL(), render_process_host->GetID(),
34 render_frame_host->GetRenderViewHost()->GetRoutingID());
35 host_zoom_->SetHostZoomLevel(navigation_handle->GetURL(), zoom_level);
36 }
37 }
38 }
39
40 void HostZoomMapObserver::RenderFrameCreated(RenderFrameHost* rfh) {
41 rfh->GetRemoteAssociatedInterfaces()->GetInterface(&host_zoom_);
42 }
43
44 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698