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.
4 
5 #ifndef ASH_DISPLAY_SCREEN_ASH_H_
6 #define ASH_DISPLAY_SCREEN_ASH_H_
7 
8 #include <stdint.h>
9 
10 #include "ash/ash_export.h"
11 #include "base/macros.h"
12 #include "ui/display/screen.h"
13 
14 namespace display {
15 class DisplayManager;
16 class DisplayObserver;
17 }
18 
19 namespace gfx {
20 class Rect;
21 }
22 
23 namespace ash {
24 
25 // Aura implementation of display::Screen. Implemented here to avoid circular
26 // dependencies.
27 class ASH_EXPORT ScreenAsh : public display::Screen {
28  public:
29   ScreenAsh();
30   ~ScreenAsh() override;
31 
32   // display::Screen overrides:
33   gfx::Point GetCursorScreenPoint() override;
34   bool IsWindowUnderCursor(gfx::NativeWindow window) override;
35   gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override;
36   gfx::NativeWindow GetLocalProcessWindowAtPoint(
37       const gfx::Point& point,
38       const std::set<gfx::NativeWindow>& ignore) override;
39   int GetNumDisplays() const override;
40   const std::vector<display::Display>& GetAllDisplays() const override;
41   display::Display GetDisplayNearestWindow(
42       gfx::NativeWindow window) const override;
43   display::Display GetDisplayNearestPoint(
44       const gfx::Point& point) const override;
45   display::Display GetDisplayMatching(
46       const gfx::Rect& match_rect) const override;
47   display::Display GetPrimaryDisplay() const override;
48   void AddObserver(display::DisplayObserver* observer) override;
49   void RemoveObserver(display::DisplayObserver* observer) override;
50 
51   // CreateDisplayManager with a ScreenAsh instance.
52   static display::DisplayManager* CreateDisplayManager();
53 
54   // Create a screen instance to be used during shutdown.
55   static void CreateScreenForShutdown();
56 
57   // Test helpers may need to clean up the ScreenForShutdown between tests.
58   static void DeleteScreenForShutdown();
59 
60  private:
61   DISALLOW_COPY_AND_ASSIGN(ScreenAsh);
62 };
63 
64 }  // namespace ash
65 
66 #endif  // ASH_DISPLAY_SCREEN_ASH_H_
67