| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_DISPLAY_SCREEN_ASH_H_ | 5 #ifndef ASH_DISPLAY_SCREEN_ASH_H_ |
| 6 #define ASH_DISPLAY_SCREEN_ASH_H_ | 6 #define ASH_DISPLAY_SCREEN_ASH_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| 11 #include "ui/gfx/display_observer.h" | 11 #include "ui/gfx/display_observer.h" |
| 12 #include "ui/gfx/screen.h" | 12 #include "ui/gfx/screen.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class Rect; | 15 class Rect; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| 19 namespace internal { | 19 namespace internal { |
| 20 class DisplayManager; | 20 class DisplayManager; |
| 21 } | 21 } |
| 22 | 22 |
| 23 // Aura implementation of gfx::Screen. Implemented here to avoid circular | 23 // Aura implementation of gfx::Screen. Implemented here to avoid circular |
| 24 // dependencies. | 24 // dependencies. |
| 25 class ASH_EXPORT ScreenAsh : public gfx::Screen { | 25 class ASH_EXPORT ScreenAsh : public gfx::Screen { |
| 26 public: | 26 public: |
| 27 ScreenAsh(); | 27 ScreenAsh(); |
| 28 virtual ~ScreenAsh(); | 28 ~ScreenAsh() override; |
| 29 | 29 |
| 30 // Finds the display that contains |point| in screeen coordinates. | 30 // Finds the display that contains |point| in screeen coordinates. |
| 31 // Returns invalid display if there is no display that can satisfy | 31 // Returns invalid display if there is no display that can satisfy |
| 32 // the condition. | 32 // the condition. |
| 33 static gfx::Display FindDisplayContainingPoint(const gfx::Point& point); | 33 static gfx::Display FindDisplayContainingPoint(const gfx::Point& point); |
| 34 | 34 |
| 35 // Returns the bounds for maximized windows in parent coordinates. | 35 // Returns the bounds for maximized windows in parent coordinates. |
| 36 // Maximized windows trigger auto-hiding the shelf. | 36 // Maximized windows trigger auto-hiding the shelf. |
| 37 static gfx::Rect GetMaximizedWindowBoundsInParent(aura::Window* window); | 37 static gfx::Rect GetMaximizedWindowBoundsInParent(aura::Window* window); |
| 38 | 38 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 54 | 54 |
| 55 // Returns a gfx::Display object for secondary display. Returns | 55 // Returns a gfx::Display object for secondary display. Returns |
| 56 // invalid display if there is no secondary display connected. | 56 // invalid display if there is no secondary display connected. |
| 57 static const gfx::Display& GetSecondaryDisplay(); | 57 static const gfx::Display& GetSecondaryDisplay(); |
| 58 | 58 |
| 59 // Returns a gfx::Display object for the specified id. Returns | 59 // Returns a gfx::Display object for the specified id. Returns |
| 60 // invalid display if no such display is connected. | 60 // invalid display if no such display is connected. |
| 61 static const gfx::Display& GetDisplayForId(int64 display_id); | 61 static const gfx::Display& GetDisplayForId(int64 display_id); |
| 62 | 62 |
| 63 // gfx::Screen overrides: | 63 // gfx::Screen overrides: |
| 64 virtual gfx::Point GetCursorScreenPoint() override; | 64 gfx::Point GetCursorScreenPoint() override; |
| 65 virtual gfx::NativeWindow GetWindowUnderCursor() override; | 65 gfx::NativeWindow GetWindowUnderCursor() override; |
| 66 virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) | 66 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; |
| 67 override; | 67 int GetNumDisplays() const override; |
| 68 virtual int GetNumDisplays() const override; | 68 std::vector<gfx::Display> GetAllDisplays() const override; |
| 69 virtual std::vector<gfx::Display> GetAllDisplays() const override; | 69 gfx::Display GetDisplayNearestWindow(gfx::NativeView view) const override; |
| 70 virtual gfx::Display GetDisplayNearestWindow( | 70 gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override; |
| 71 gfx::NativeView view) const override; | 71 gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) const override; |
| 72 virtual gfx::Display GetDisplayNearestPoint( | 72 gfx::Display GetPrimaryDisplay() const override; |
| 73 const gfx::Point& point) const override; | 73 void AddObserver(gfx::DisplayObserver* observer) override; |
| 74 virtual gfx::Display GetDisplayMatching( | 74 void RemoveObserver(gfx::DisplayObserver* observer) override; |
| 75 const gfx::Rect& match_rect) const override; | |
| 76 virtual gfx::Display GetPrimaryDisplay() const override; | |
| 77 virtual void AddObserver(gfx::DisplayObserver* observer) override; | |
| 78 virtual void RemoveObserver(gfx::DisplayObserver* observer) override; | |
| 79 | 75 |
| 80 private: | 76 private: |
| 81 friend class DisplayManager; | 77 friend class DisplayManager; |
| 82 | 78 |
| 83 // Notifies observers of display configuration changes. | 79 // Notifies observers of display configuration changes. |
| 84 void NotifyMetricsChanged(const gfx::Display& display, uint32_t metrics); | 80 void NotifyMetricsChanged(const gfx::Display& display, uint32_t metrics); |
| 85 void NotifyDisplayAdded(const gfx::Display& display); | 81 void NotifyDisplayAdded(const gfx::Display& display); |
| 86 void NotifyDisplayRemoved(const gfx::Display& display); | 82 void NotifyDisplayRemoved(const gfx::Display& display); |
| 87 | 83 |
| 88 // Creates a screen that can be used during shutdown. | 84 // Creates a screen that can be used during shutdown. |
| 89 // It simply has a copy of the displays. | 85 // It simply has a copy of the displays. |
| 90 gfx::Screen* CloneForShutdown(); | 86 gfx::Screen* CloneForShutdown(); |
| 91 | 87 |
| 92 ObserverList<gfx::DisplayObserver> observers_; | 88 ObserverList<gfx::DisplayObserver> observers_; |
| 93 | 89 |
| 94 DISALLOW_COPY_AND_ASSIGN(ScreenAsh); | 90 DISALLOW_COPY_AND_ASSIGN(ScreenAsh); |
| 95 }; | 91 }; |
| 96 | 92 |
| 97 } // namespace ash | 93 } // namespace ash |
| 98 | 94 |
| 99 #endif // ASH_DISPLAY_SCREEN_ASH_H_ | 95 #endif // ASH_DISPLAY_SCREEN_ASH_H_ |
| OLD | NEW |