summaryrefslogtreecommitdiff
path: root/chromium/ui/views/mus/screen_mus.h
blob: 4987b07edaaf620311e051118f5823cbd5d2806f (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 UI_VIEWS_MUS_SCREEN_MUS_H_
#define UI_VIEWS_MUS_SCREEN_MUS_H_

#include "mojo/public/cpp/bindings/binding.h"
#include "services/ui/public/interfaces/display_manager.mojom.h"
#include "ui/display/screen_base.h"
#include "ui/views/mus/mus_export.h"

namespace service_manager {
class Connector;
}

namespace views {

class ScreenMusDelegate;

// Screen implementation backed by ui::mojom::DisplayManager.
class VIEWS_MUS_EXPORT ScreenMus : public display::ScreenBase,
                                   public ui::mojom::DisplayManagerObserver {
 public:
  explicit ScreenMus(ScreenMusDelegate* delegate);
  ~ScreenMus() override;

  void Init(service_manager::Connector* connector);

 private:
  friend class ScreenMusTestApi;

  // display::Screen:
  display::Display GetDisplayNearestWindow(
      gfx::NativeWindow window) const override;
  gfx::Point GetCursorScreenPoint() override;
  bool IsWindowUnderCursor(gfx::NativeWindow window) override;
  aura::Window* GetWindowAtScreenPoint(const gfx::Point& point) override;

  // ui::mojom::DisplayManager:
  void OnDisplaysChanged(std::vector<ui::mojom::WsDisplayPtr> ws_displays,
                         int64_t primary_display_id,
                         int64_t internal_display_id) override;

  ScreenMusDelegate* delegate_;
  ui::mojom::DisplayManagerPtr display_manager_;
  mojo::Binding<ui::mojom::DisplayManagerObserver>
      display_manager_observer_binding_;

  DISALLOW_COPY_AND_ASSIGN(ScreenMus);
};

}  // namespace views

#endif  // UI_VIEWS_MUS_SCREEN_MUS_H_