1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_OTR_DELEGATE_H_
6 #define CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_OTR_DELEGATE_H_
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h"
11 #include "content/public/browser/host_zoom_map.h"
12 #include "content/public/browser/zoom_level_delegate.h"
15 class ZoomEventManager
;
20 // This class is a light-weight version of ChromeZoomLevelPrefs and is used
21 // to connect an OTR StoragePartition's HostZoomMap to the OTR profile's
23 class ChromeZoomLevelOTRDelegate
: public content::ZoomLevelDelegate
{
25 ChromeZoomLevelOTRDelegate(
26 base::WeakPtr
<ui_zoom::ZoomEventManager
> zoom_event_manager
);
27 ~ChromeZoomLevelOTRDelegate() override
;
29 // content::ZoomLevelDelegate
30 void InitHostZoomMap(content::HostZoomMap
* host_zoom_map
) override
;
33 // This is a callback function that receives notifications from HostZoomMap
34 // when per-host zoom levels change. It is used to update the per-host
35 // zoom levels (if any) managed by this class (for its associated partition).
36 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange
& change
);
38 base::WeakPtr
<ui_zoom::ZoomEventManager
> zoom_event_manager_
;
39 content::HostZoomMap
* host_zoom_map_
;
40 scoped_ptr
<content::HostZoomMap::Subscription
> zoom_subscription_
;
42 DISALLOW_COPY_AND_ASSIGN(ChromeZoomLevelOTRDelegate
);
47 #endif // CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_OTR_DELEGATE_H_