| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_DISPLAY_SCREEN_H_ | 5 #ifndef UI_DISPLAY_SCREEN_H_ |
| 6 #define UI_DISPLAY_SCREEN_H_ | 6 #define UI_DISPLAY_SCREEN_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 // Returns the window at the given screen coordinate |point|. | 47 // Returns the window at the given screen coordinate |point|. |
| 48 virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) = 0; | 48 virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) = 0; |
| 49 | 49 |
| 50 // Returns the number of displays. | 50 // Returns the number of displays. |
| 51 // Mirrored displays are excluded; this method is intended to return the | 51 // Mirrored displays are excluded; this method is intended to return the |
| 52 // number of distinct, usable displays. | 52 // number of distinct, usable displays. |
| 53 virtual int GetNumDisplays() const = 0; | 53 virtual int GetNumDisplays() const = 0; |
| 54 | 54 |
| 55 // Returns the list of displays that are currently available. | 55 // Returns the list of displays that are currently available. |
| 56 virtual const std::vector<display::Display>& GetAllDisplays() const = 0; | 56 virtual const std::vector<Display>& GetAllDisplays() const = 0; |
| 57 | 57 |
| 58 // Returns the display nearest the specified window. | 58 // Returns the display nearest the specified window. |
| 59 // If the window is NULL or the window is not rooted to a display this will | 59 // If the window is NULL or the window is not rooted to a display this will |
| 60 // return the primary display. | 60 // return the primary display. |
| 61 virtual display::Display GetDisplayNearestWindow( | 61 virtual Display GetDisplayNearestWindow(gfx::NativeView view) const = 0; |
| 62 gfx::NativeView view) const = 0; | |
| 63 | 62 |
| 64 // Returns the display nearest the specified point. |point| should be in DIPs. | 63 // Returns the display nearest the specified point. |point| should be in DIPs. |
| 65 virtual display::Display GetDisplayNearestPoint( | 64 virtual Display GetDisplayNearestPoint(const gfx::Point& point) const = 0; |
| 66 const gfx::Point& point) const = 0; | |
| 67 | 65 |
| 68 // Returns the display that most closely intersects the provided bounds. | 66 // Returns the display that most closely intersects the provided bounds. |
| 69 virtual display::Display GetDisplayMatching( | 67 virtual Display GetDisplayMatching(const gfx::Rect& match_rect) const = 0; |
| 70 const gfx::Rect& match_rect) const = 0; | |
| 71 | 68 |
| 72 // Returns the primary display. | 69 // Returns the primary display. |
| 73 virtual display::Display GetPrimaryDisplay() const = 0; | 70 virtual Display GetPrimaryDisplay() const = 0; |
| 74 | 71 |
| 75 // Adds/Removes display observers. | 72 // Adds/Removes display observers. |
| 76 virtual void AddObserver(DisplayObserver* observer) = 0; | 73 virtual void AddObserver(DisplayObserver* observer) = 0; |
| 77 virtual void RemoveObserver(DisplayObserver* observer) = 0; | 74 virtual void RemoveObserver(DisplayObserver* observer) = 0; |
| 78 | 75 |
| 79 // Converts |screen_rect| to DIP coordinates in the context of |view| clamping | 76 // Converts |screen_rect| to DIP coordinates in the context of |view| clamping |
| 80 // to the enclosing rect if the coordinates do not fall on pixel boundaries. | 77 // to the enclosing rect if the coordinates do not fall on pixel boundaries. |
| 81 // If |view| is null, the primary display is used as the context. | 78 // If |view| is null, the primary display is used as the context. |
| 82 virtual gfx::Rect ScreenToDIPRectInWindow(gfx::NativeView view, | 79 virtual gfx::Rect ScreenToDIPRectInWindow(gfx::NativeView view, |
| 83 const gfx::Rect& screen_rect) const; | 80 const gfx::Rect& screen_rect) const; |
| 84 | 81 |
| 85 // Converts |dip_rect| to screen coordinates in the context of |view| clamping | 82 // Converts |dip_rect| to screen coordinates in the context of |view| clamping |
| 86 // to the enclosing rect if the coordinates do not fall on pixel boundaries. | 83 // to the enclosing rect if the coordinates do not fall on pixel boundaries. |
| 87 // If |view| is null, the primary display is used as the context. | 84 // If |view| is null, the primary display is used as the context. |
| 88 virtual gfx::Rect DIPToScreenRectInWindow(gfx::NativeView view, | 85 virtual gfx::Rect DIPToScreenRectInWindow(gfx::NativeView view, |
| 89 const gfx::Rect& dip_rect) const; | 86 const gfx::Rect& dip_rect) const; |
| 90 | 87 |
| 91 // Returns true if the display with |display_id| is found and returns that | 88 // Returns true if the display with |display_id| is found and returns that |
| 92 // display in |display|. Otherwise returns false and |display| remains | 89 // display in |display|. Otherwise returns false and |display| remains |
| 93 // untouched. | 90 // untouched. |
| 94 bool GetDisplayWithDisplayId(int64_t display_id, | 91 bool GetDisplayWithDisplayId(int64_t display_id, Display* display) const; |
| 95 display::Display* display) const; | |
| 96 | 92 |
| 97 private: | 93 private: |
| 98 DISALLOW_COPY_AND_ASSIGN(Screen); | 94 DISALLOW_COPY_AND_ASSIGN(Screen); |
| 99 }; | 95 }; |
| 100 | 96 |
| 101 Screen* CreateNativeScreen(); | 97 Screen* CreateNativeScreen(); |
| 102 | 98 |
| 103 } // namespace display | 99 } // namespace display |
| 104 | 100 |
| 105 #endif // UI_DISPLAY_SCREEN_H_ | 101 #endif // UI_DISPLAY_SCREEN_H_ |
| OLD | NEW |