Adding instrumentation to locate the source of jankiness
[chromium-blink-merge.git] / chrome / browser / ui / zoom / zoom_event_manager.h
blob306ce0b7471d47f6ea7bb62007d820ceb344084f
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_ZOOM_EVENT_MANAGER_H_
6 #define CHROME_BROWSER_UI_ZOOM_ZOOM_EVENT_MANAGER_H_
8 #include "base/callback_list.h"
9 #include "base/supports_user_data.h"
10 #include "content/public/browser/host_zoom_map.h"
12 namespace content {
13 class BrowserContext;
14 } // namespace content
16 // This class serves as a target for event notifications from all ZoomController
17 // objects. Classes that need to know about browser-specific zoom events (e.g.
18 // manual-mode zoom) should subscribe here.
19 class ZoomEventManager : public base::SupportsUserData::Data {
20 public:
21 ZoomEventManager();
22 virtual ~ZoomEventManager();
24 // Returns the ZoomEventManager for the specified BrowserContext. This
25 // function creates the ZoomEventManager if it hasn't been created already.
26 static ZoomEventManager* GetForBrowserContext(
27 content::BrowserContext* context);
29 // Called by ZoomControllers when changes are made to zoom levels in manual
30 // mode in order that browser listeners can be notified.
31 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change);
33 // Add and remove zoom level changed callbacks.
34 scoped_ptr<content::HostZoomMap::Subscription> AddZoomLevelChangedCallback(
35 const content::HostZoomMap::ZoomLevelChangedCallback& callback);
37 private:
38 base::CallbackList<void(const content::HostZoomMap::ZoomLevelChange&)>
39 zoom_level_changed_callbacks_;
41 DISALLOW_COPY_AND_ASSIGN(ZoomEventManager);
44 #endif // CHROME_BROWSER_UI_ZOOM_ZOOM_EVENT_MANAGER_H_