summaryrefslogtreecommitdiffstats
path: root/ui/gfx/display_change_notifier.h
blob: 458dd6ac66c435fc44e477ec2066636f08ceae2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_GFX_DISPLAY_CHANGE_NOTIFIER_H_
#define UI_GFX_DISPLAY_CHANGE_NOTIFIER_H_

#include <vector>

#include "base/macros.h"
#include "base/observer_list.h"
#include "ui/gfx/gfx_export.h"

namespace gfx {

class Display;
class DisplayObserver;

// DisplayChangeNotifier is a class implementing the handling of DisplayObserver
// notification for Screen.
class GFX_EXPORT DisplayChangeNotifier {
 public:
  DisplayChangeNotifier();
  ~DisplayChangeNotifier();

  void AddObserver(DisplayObserver* observer);

  void RemoveObserver(DisplayObserver* observer);

  void NotifyDisplaysChanged(const std::vector<Display>& old_displays,
                             const std::vector<Display>& new_displays);

 private:
  // The observers that need to be notified when a display is modified, added
  // or removed.
  base::ObserverList<DisplayObserver> observer_list_;

  DISALLOW_COPY_AND_ASSIGN(DisplayChangeNotifier);
};

} // namespace gfx

#endif // UI_GFX_DISPLAY_CHANGE_NOTIFIER_H_