From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Kleinschmidt <kleinschmidtorama@gmail.com>
Date: Mon, 23 Sep 2019 17:07:53 -0400
Subject: add zoom limit setters to webcontents

Allows minimum_zoom_percent_ and maximum_zoom_percent_ to be set on WebContents.
This is needed by Electron to allow apps to limit how much an app can zoom in
or out.

diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index c13511e26189e68376e29f38c4ae2e1cc8fd3c57..a5c4162b3c69b534f843e1b6737392c867fc88ea 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4124,10 +4124,18 @@ bool WebContentsImpl::GetClosedByUserGesture() {
   return closed_by_user_gesture_;
 }
 
+void WebContentsImpl::SetMinimumZoomPercent(int zoom_percent) {
+  minimum_zoom_percent_ = zoom_percent;
+}
+
 int WebContentsImpl::GetMinimumZoomPercent() {
   return minimum_zoom_percent_;
 }
 
+void WebContentsImpl::SetMaximumZoomPercent(int zoom_percent) {
+  maximum_zoom_percent_ = zoom_percent;
+}
+
 int WebContentsImpl::GetMaximumZoomPercent() {
   return maximum_zoom_percent_;
 }
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index ea1b3581ead984ac084fc9a2b9daf85f6756ea5c..b967e02b4052426855a2af88abbced2076b3e04a 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -447,7 +447,9 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
   void SystemDragEnded(RenderWidgetHost* source_rwh) override;
   void SetClosedByUserGesture(bool value) override;
   bool GetClosedByUserGesture() override;
+  void SetMinimumZoomPercent(int zoom_percent) override;
   int GetMinimumZoomPercent() override;
+  void SetMaximumZoomPercent(int zoom_percent) override;
   int GetMaximumZoomPercent() override;
   void SetPageScale(float page_scale_factor) override;
   gfx::Size GetPreferredSize() override;
@@ -1690,8 +1692,8 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
   bool closed_by_user_gesture_;
 
   // Minimum/maximum zoom percent.
-  const int minimum_zoom_percent_;
-  const int maximum_zoom_percent_;
+  int minimum_zoom_percent_;
+  int maximum_zoom_percent_;
 
   // Used to correctly handle integer zooming through a smooth scroll device.
   float zoom_scroll_remainder_;
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index 750de66b8002ba66d0f2247d0075da1e51ac764c..1a57feeb1dfe08f8ce1113cb5d8c8ab57d761094 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -812,8 +812,10 @@ class WebContents : public PageNavigator,
   virtual void SetClosedByUserGesture(bool value) = 0;
   virtual bool GetClosedByUserGesture() = 0;
 
-  // Gets the minimum/maximum zoom percent.
+  // Gets/sets the minimum/maximum zoom percent.
+  virtual void SetMinimumZoomPercent(int zoom_percent) = 0;
   virtual int GetMinimumZoomPercent() = 0;
+  virtual void SetMaximumZoomPercent(int zoom_percent) = 0;
   virtual int GetMaximumZoomPercent() = 0;
 
   // Set the renderer's page scale to the given factor.
