Index: components/zoom/zoom_controller.h |
diff --git a/components/zoom/zoom_controller.h b/components/zoom/zoom_controller.h |
index 159b74843371ba3aec1c71f9b45468729e78162b..a7a18a3858d10f7114f8b272b4ffb0d7ac0129f8 100644 |
--- a/components/zoom/zoom_controller.h |
+++ b/components/zoom/zoom_controller.h |
@@ -8,6 +8,7 @@ |
#include <memory> |
#include "base/compiler_specific.h" |
+#include "base/gtest_prod_util.h" |
#include "base/macros.h" |
#include "base/memory/ref_counted.h" |
#include "base/observer_list.h" |
@@ -15,8 +16,11 @@ |
#include "content/public/browser/host_zoom_map.h" |
#include "content/public/browser/web_contents_observer.h" |
#include "content/public/browser/web_contents_user_data.h" |
+#include "content/public/browser/zoom_level_delegate.h" |
class ZoomControllerTest; |
+FORWARD_DECLARE_TEST(ZoomControllerTest, OnDefaultZoomScopeChanged); |
+FORWARD_DECLARE_TEST(ZoomControllerPerTabTest, OnDefaultZoomScopeChanged); |
namespace content { |
class WebContents; |
@@ -48,6 +52,7 @@ class ZoomController : public content::WebContentsObserver, |
// Results in default zoom behavior, i.e. zoom changes are handled |
// automatically and on a per-origin basis, meaning that other tabs |
// navigated to the same origin will also zoom. |
+ // TODO Would we want to rename this? |
wjmaclean
2017/01/19 21:09:05
Nit: write as "TODO(<ldap>):"
Kevin McNee
2017/02/03 23:17:20
Acknowledged.
|
ZOOM_MODE_DEFAULT, |
// Results in zoom changes being handled automatically, but on a per-tab |
// basis. Tabs in this zoom mode will not be affected by zoom changes in |
@@ -155,6 +160,11 @@ class ZoomController : public content::WebContentsObserver, |
void WebContentsDestroyed() override; |
void RenderFrameHostChanged(content::RenderFrameHost* old_host, |
content::RenderFrameHost* new_host) override; |
+ void DidCloneToNewWebContents( |
+ content::WebContents* old_web_contents, |
+ content::WebContents* new_web_contents) override; |
+ void WebContentsReplaced(content::WebContents* old_web_contents, |
+ content::WebContents* new_web_contents) override; |
protected: |
// Protected for testing. |
@@ -163,9 +173,16 @@ class ZoomController : public content::WebContentsObserver, |
private: |
friend class content::WebContentsUserData<ZoomController>; |
friend class ::ZoomControllerTest; |
+ FRIEND_TEST_ALL_PREFIXES(::ZoomControllerTest, OnDefaultZoomScopeChanged); |
+ FRIEND_TEST_ALL_PREFIXES(::ZoomControllerPerTabTest, |
+ OnDefaultZoomScopeChanged); |
void ResetZoomModeOnNavigationIfNeeded(const GURL& url); |
+ void UpdateZoomModeOnScopeChangeIfNeeded(); |
+ void PreserveTemporaryZoomLevel(content::WebContents* old_web_contents, |
+ content::WebContents* new_web_contents) const; |
void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); |
+ void OnDefaultZoomScopeChanged(); |
// Updates the zoom icon and zoom percentage based on current values and |
// notifies the observer if changes have occurred. |host| may be empty, |
@@ -179,6 +196,10 @@ class ZoomController : public content::WebContentsObserver, |
// The current zoom mode. |
ZoomMode zoom_mode_; |
+ // Whether zoom changes are by default scoped to a page's origin. |
+ // If false, they are scoped to the tab. |
+ bool default_per_origin_; |
+ |
// Current zoom level. |
double zoom_level_; |
@@ -196,6 +217,8 @@ class ZoomController : public content::WebContentsObserver, |
content::HostZoomMap* host_zoom_map_; |
std::unique_ptr<content::HostZoomMap::Subscription> zoom_subscription_; |
+ std::unique_ptr<content::ZoomLevelDelegate::DefaultZoomScopeSubscription> |
+ default_zoom_scope_subscription_; |
DISALLOW_COPY_AND_ASSIGN(ZoomController); |
}; |