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.
5 #ifndef ASH_DISPLAY_SCREEN_ASH_H_
6 #define ASH_DISPLAY_SCREEN_ASH_H_
8 #include "ash/ash_export.h"
9 #include "base/compiler_specific.h"
10 #include "base/observer_list.h"
11 #include "ui/gfx/display_observer.h"
12 #include "ui/gfx/screen.h"
23 // Aura implementation of gfx::Screen. Implemented here to avoid circular
25 class ASH_EXPORT ScreenAsh
: public gfx::Screen
{
28 ~ScreenAsh() override
;
30 // gfx::Screen overrides:
31 gfx::Point
GetCursorScreenPoint() override
;
32 gfx::NativeWindow
GetWindowUnderCursor() override
;
33 gfx::NativeWindow
GetWindowAtScreenPoint(const gfx::Point
& point
) override
;
34 int GetNumDisplays() const override
;
35 std::vector
<gfx::Display
> GetAllDisplays() const override
;
36 gfx::Display
GetDisplayNearestWindow(gfx::NativeView view
) const override
;
37 gfx::Display
GetDisplayNearestPoint(const gfx::Point
& point
) const override
;
38 gfx::Display
GetDisplayMatching(const gfx::Rect
& match_rect
) const override
;
39 gfx::Display
GetPrimaryDisplay() const override
;
40 void AddObserver(gfx::DisplayObserver
* observer
) override
;
41 void RemoveObserver(gfx::DisplayObserver
* observer
) override
;
44 friend class DisplayManager
;
46 // Notifies observers of display configuration changes.
47 void NotifyMetricsChanged(const gfx::Display
& display
, uint32_t metrics
);
48 void NotifyDisplayAdded(const gfx::Display
& display
);
49 void NotifyDisplayRemoved(const gfx::Display
& display
);
51 // Creates a screen that can be used during shutdown.
52 // It simply has a copy of the displays.
53 gfx::Screen
* CloneForShutdown();
55 base::ObserverList
<gfx::DisplayObserver
> observers_
;
57 DISALLOW_COPY_AND_ASSIGN(ScreenAsh
);
62 #endif // ASH_DISPLAY_SCREEN_ASH_H_