| Index: components/zoom/zoom_controller.h
|
| diff --git a/components/zoom/zoom_controller.h b/components/zoom/zoom_controller.h
|
| index b0ecd4cf625372e8bd0a88ad4aa5bcd3a6914363..e95d43f1545551d90cbf6a861c64dc01e84a9fb3 100644
|
| --- a/components/zoom/zoom_controller.h
|
| +++ b/components/zoom/zoom_controller.h
|
| @@ -8,15 +8,20 @@
|
| #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"
|
| #include "components/prefs/pref_member.h"
|
| +#include "components/zoom/zoom_prefs_delegate.h"
|
| #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;
|
| @@ -148,12 +153,20 @@ class ZoomController : public content::WebContentsObserver,
|
| void SetPageScaleFactorIsOneForTesting(bool is_one);
|
| bool PageScaleFactorIsOne() const;
|
|
|
| + // Called by TabStripModel to notify us when it replaces a tab's WebContents
|
| + // with another.
|
| + // Virtual for testing.
|
| + virtual void WebContentsReplaced(content::WebContents* new_web_contents);
|
| +
|
| // content::WebContentsObserver overrides:
|
| void DidFinishNavigation(
|
| content::NavigationHandle* navigation_handle) override;
|
| 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;
|
|
|
| protected:
|
| // Protected for testing.
|
| @@ -162,9 +175,20 @@ 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(const content::HostZoomMap* old_zoom_map,
|
| + content::HostZoomMap* new_zoom_map,
|
| + content::RenderFrameHost* old_host,
|
| + content::RenderFrameHost* new_host) const;
|
| + 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,
|
| @@ -178,6 +202,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_scope_is_per_origin_;
|
| +
|
| // Current zoom level.
|
| double zoom_level_;
|
|
|
| @@ -195,6 +223,8 @@ class ZoomController : public content::WebContentsObserver,
|
| content::HostZoomMap* host_zoom_map_;
|
|
|
| std::unique_ptr<content::HostZoomMap::Subscription> zoom_subscription_;
|
| + std::unique_ptr<ZoomPrefsDelegate::DefaultZoomScopeSubscription>
|
| + default_zoom_scope_subscription_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ZoomController);
|
| };
|
|
|