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

Unified Diff: content/browser/host_zoom_map_impl.cc

Issue 301243018: Fix issue with Virtual vs. real URLs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modify entry checking in SetZoomLevel(). Created 6 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/host_zoom_map_impl.cc
diff --git a/content/browser/host_zoom_map_impl.cc b/content/browser/host_zoom_map_impl.cc
index a14b163c4ceb014fe06e94943b387992a62ca59c..8ccf9d8dba505644da856fcbb728b398c852b9db 100644
--- a/content/browser/host_zoom_map_impl.cc
+++ b/content/browser/host_zoom_map_impl.cc
@@ -221,11 +221,14 @@ double HostZoomMapImpl::GetZoomLevelForWebContents(
if (UsesTemporaryZoomLevel(render_process_id, routing_id))
return GetTemporaryZoomLevel(render_process_id, routing_id);
- // Since zoom map is updated using the url as stored in the navigation
- // controller, we use that URL to get the zoom level.
+ // Get the url from the navigation controller directly, as calling
+ // WebContentsImpl::GetLastCommittedURL() may give us a virtual url that
+ // is different than is stored in the map.
GURL url;
NavigationEntry* entry =
web_contents_impl.GetController().GetLastCommittedEntry();
+ // It is possible for a WebContent's zoom level to be queried before
+ // a navigation has occurred.
if (entry)
url = entry->GetURL();
Peter Kasting 2014/06/04 20:03:40 Nit: You still have an extra space both here and i
return GetZoomLevelForHostAndScheme(url.scheme(),
@@ -238,12 +241,18 @@ void HostZoomMapImpl::SetZoomLevelForWebContents(
int render_process_id = web_contents_impl.GetRenderProcessHost()->GetID();
int render_view_id = web_contents_impl.GetRenderViewHost()->GetRoutingID();
if (UsesTemporaryZoomLevel(render_process_id, render_view_id)) {
-
SetTemporaryZoomLevel(render_process_id, render_view_id, level);
} else {
- SetZoomLevelForHost(
- net::GetHostOrSpecFromURL(web_contents_impl.GetLastCommittedURL()),
- level);
+ // Get the url from the navigation controller directly, as calling
+ // WebContentsImpl::GetLastCommittedURL() may give us a virtual url that
+ // is different than what the render view is using. If the two don't match,
+ // the attempt to set the zoom will fail.
+ GURL url;
+ NavigationEntry* entry =
+ web_contents_impl.GetController().GetLastCommittedEntry();
+ DCHECK(entry);
+ url = entry->GetURL();
+ SetZoomLevelForHost(net::GetHostOrSpecFromURL(url), level);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698