summaryrefslogtreecommitdiffstats
path: root/ui/aura/single_display_manager.h
blob: de31ab6ed5f95864a58665df4b9ffb95b12ba8be (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (c) 2012 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_AURA_SINGLE_DISPLAY_MANAGER_H_
#define UI_AURA_SINGLE_DISPLAY_MANAGER_H_

#include "base/compiler_specific.h"
#include "ui/aura/aura_export.h"
#include "ui/aura/display_manager.h"
#include "ui/aura/window_observer.h"
#include "ui/gfx/display.h"

namespace gfx {
class Rect;
}

namespace aura {

// A display manager assuming there is one display.
class AURA_EXPORT SingleDisplayManager : public DisplayManager,
                                         public WindowObserver {
 public:
  SingleDisplayManager();
  virtual ~SingleDisplayManager();

  // DisplayManager overrides:
  virtual void OnNativeDisplaysChanged(
      const std::vector<gfx::Display>& display) OVERRIDE;
  virtual RootWindow* CreateRootWindowForDisplay(
      const gfx::Display& display) OVERRIDE;
  virtual gfx::Display* GetDisplayAt(size_t index) OVERRIDE;

  virtual size_t GetNumDisplays() const OVERRIDE;

  virtual const gfx::Display& GetDisplayNearestWindow(
      const Window* window) const OVERRIDE;
  virtual const gfx::Display& GetDisplayNearestPoint(
      const gfx::Point& point) const OVERRIDE;
  virtual const gfx::Display& GetDisplayMatching(
      const gfx::Rect& match_rect) const OVERRIDE;
  virtual std::string GetDisplayNameFor(const gfx::Display& display) OVERRIDE;

  // WindowObserver overrides:
  virtual void OnWindowBoundsChanged(Window* window,
                                     const gfx::Rect& old_bounds,
                                     const gfx::Rect& new_bounds) OVERRIDE;
  virtual void OnWindowDestroying(Window* window) OVERRIDE;

 private:
  void Init();
  void Update(const gfx::Size size);

  RootWindow* root_window_;
  gfx::Display display_;

  DISALLOW_COPY_AND_ASSIGN(SingleDisplayManager);
};

}  // namespace aura

#endif  // UI_AURA_SINGLE_DISPLAY_MANAGER_H_