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

Unified Diff: content/browser/host_zoom_map_impl.cc

Issue 954923005: Make command-zero reset page scale in addition to zoom level (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again again Created 5 years, 9 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_impl.h ('k') | content/browser/renderer_host/render_view_host_impl.h » ('j') | 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 4260bbf2397444f1a79a2e64e840adaef273a6d3..2881a44c98ca4e9774c5f9f6d2c56f74bf136a63 100644
--- a/content/browser/host_zoom_map_impl.cc
+++ b/content/browser/host_zoom_map_impl.cc
@@ -91,6 +91,13 @@ double HostZoomMap::GetZoomLevel(const WebContents* web_contents) {
*static_cast<const WebContentsImpl*>(web_contents));
}
+bool HostZoomMap::PageScaleFactorIsOne(const WebContents* web_contents) {
+ HostZoomMapImpl* host_zoom_map = static_cast<HostZoomMapImpl*>(
+ HostZoomMap::GetForWebContents(web_contents));
+ return host_zoom_map->PageScaleFactorIsOneForWebContents(
+ *static_cast<const WebContentsImpl*>(web_contents));
+}
+
void HostZoomMap::SetZoomLevel(const WebContents* web_contents, double level) {
HostZoomMapImpl* host_zoom_map = static_cast<HostZoomMapImpl*>(
HostZoomMap::GetForWebContents(web_contents));
@@ -334,6 +341,39 @@ void HostZoomMapImpl::SetZoomLevelForView(int render_process_id,
SetZoomLevelForHost(host, level);
}
+void HostZoomMapImpl::SetPageScaleFactorIsOneForView(int render_process_id,
+ int render_view_id,
+ bool is_one) {
+ {
+ base::AutoLock auto_lock(lock_);
+ view_page_scale_factors_are_one_[RenderViewKey(render_process_id,
+ render_view_id)] = is_one;
+ }
+ HostZoomMap::ZoomLevelChange change;
+ change.mode = HostZoomMap::PAGE_SCALE_IS_ONE_CHANGED;
+ zoom_level_changed_callbacks_.Notify(change);
+}
+
+bool HostZoomMapImpl::PageScaleFactorIsOneForWebContents(
+ const WebContentsImpl& web_contents_impl) const {
+ if (!web_contents_impl.GetRenderProcessHost())
+ return true;
+ base::AutoLock auto_lock(lock_);
+ auto found = view_page_scale_factors_are_one_.find(
+ RenderViewKey(web_contents_impl.GetRenderProcessHost()->GetID(),
+ web_contents_impl.GetRoutingID()));
+ if (found == view_page_scale_factors_are_one_.end())
+ return true;
+ return found->second;
+}
+
+void HostZoomMapImpl::ClearPageScaleFactorIsOneForView(int render_process_id,
+ int render_view_id) {
+ base::AutoLock auto_lock(lock_);
+ view_page_scale_factors_are_one_.erase(
+ RenderViewKey(render_process_id, render_view_id));
+}
+
bool HostZoomMapImpl::UsesTemporaryZoomLevel(int render_process_id,
int render_view_id) const {
RenderViewKey key(render_process_id, render_view_id);
@@ -397,6 +437,7 @@ void HostZoomMapImpl::Observe(int type,
int render_process_id =
Source<RenderViewHost>(source)->GetProcess()->GetID();
ClearTemporaryZoomLevel(render_process_id, render_view_id);
+ ClearPageScaleFactorIsOneForView(render_process_id, render_view_id);
break;
}
default:
« no previous file with comments | « content/browser/host_zoom_map_impl.h ('k') | content/browser/renderer_host/render_view_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698