summaryrefslogtreecommitdiff
path: root/chromium/services/ui/display/screen_manager.h
blob: 017b40db9addb8983baadbc00ce2932fa17bc131 (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
// Copyright 2016 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 SERVICES_UI_DISPLAY_SCREEN_MANAGER_H_
#define SERVICES_UI_DISPLAY_SCREEN_MANAGER_H_

#include <memory>

#include "base/macros.h"
#include "services/ui/display/screen_manager_delegate.h"

namespace service_manager {
class BinderRegistry;
}

namespace display {

class ScreenBase;

// ScreenManager provides the necessary functionality to configure all
// attached physical displays.
class ScreenManager {
 public:
  ScreenManager();
  virtual ~ScreenManager();

  // Creates a singleton ScreenManager instance.
  static std::unique_ptr<ScreenManager> Create();
  static ScreenManager* GetInstance();

  // Registers Mojo interfaces provided.
  virtual void AddInterfaces(service_manager::BinderRegistry* registry) = 0;

  // Triggers initial display configuration to start. On device this will
  // configuration the connected displays. Off device this will create one or
  // more fake displays and pretend to configure them. A non-null |delegate|
  // must be provided that will receive notifications when displays are added,
  // removed or modified.
  virtual void Init(ScreenManagerDelegate* delegate) = 0;

  // Handle requests from the platform to close a display.
  virtual void RequestCloseDisplay(int64_t display_id) = 0;

  virtual display::ScreenBase* GetScreen() = 0;

 private:
  static ScreenManager* instance_;  // Instance is not owned.

  DISALLOW_COPY_AND_ASSIGN(ScreenManager);
};

}  // namespace display

#endif  // SERVICES_UI_DISPLAY_SCREEN_MANAGER_H_