Chromium Code Reviews| 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 ASH_SCREEN_ASH_H_ | 5 #ifndef ASH_DISPLAY_SCREEN_ASH_H_ |
| 6 #define ASH_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/screen.h" | 11 #include "ui/gfx/screen.h" |
| 12 | 12 |
| 13 namespace gfx { | 13 namespace gfx { |
| 14 class Rect; | 14 class Rect; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace ash { | 17 namespace ash { |
| 18 namespace internal { | |
| 19 class DisplayManager; | |
| 20 } | |
| 18 | 21 |
| 19 // Aura implementation of gfx::Screen. Implemented here to avoid circular | 22 // Aura implementation of gfx::Screen. Implemented here to avoid circular |
| 20 // dependencies. | 23 // dependencies. |
| 21 class ASH_EXPORT ScreenAsh : public gfx::Screen { | 24 class ASH_EXPORT ScreenAsh : public gfx::Screen { |
| 22 public: | 25 public: |
| 23 ScreenAsh(); | 26 ScreenAsh(); |
| 24 virtual ~ScreenAsh(); | 27 virtual ~ScreenAsh(); |
| 25 | 28 |
| 26 // Finds the display that contains |point| in screeen coordinates. | 29 // Finds the display that contains |point| in screeen coordinates. |
| 27 // Returns invalid display if there is no display that can satisfy | 30 // Returns invalid display if there is no display that can satisfy |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 49 const gfx::Rect& rect); | 52 const gfx::Rect& rect); |
| 50 | 53 |
| 51 // Returns a gfx::Display object for secondary display. Returns | 54 // Returns a gfx::Display object for secondary display. Returns |
| 52 // invalid display if there is no secondary display connected. | 55 // invalid display if there is no secondary display connected. |
| 53 static const gfx::Display& GetSecondaryDisplay(); | 56 static const gfx::Display& GetSecondaryDisplay(); |
| 54 | 57 |
| 55 // Returns a gfx::Display object for the specified id. Returns | 58 // Returns a gfx::Display object for the specified id. Returns |
| 56 // invalid display if no such display is connected. | 59 // invalid display if no such display is connected. |
| 57 static const gfx::Display& GetDisplayForId(int64 display_id); | 60 static const gfx::Display& GetDisplayForId(int64 display_id); |
| 58 | 61 |
| 59 // Notifies observers of display configuration changes. | |
| 60 void NotifyBoundsChanged(const gfx::Display& display); | |
| 61 void NotifyDisplayAdded(const gfx::Display& display); | |
| 62 void NotifyDisplayRemoved(const gfx::Display& display); | |
| 63 | |
| 64 protected: | |
| 65 // gfx::Screen overrides: | 62 // gfx::Screen overrides: |
| 66 virtual bool IsDIPEnabled() OVERRIDE; | 63 virtual bool IsDIPEnabled() OVERRIDE; |
| 67 virtual gfx::Point GetCursorScreenPoint() OVERRIDE; | 64 virtual gfx::Point GetCursorScreenPoint() OVERRIDE; |
| 68 virtual gfx::NativeWindow GetWindowUnderCursor() OVERRIDE; | 65 virtual gfx::NativeWindow GetWindowUnderCursor() OVERRIDE; |
| 69 virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) | 66 virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) |
| 70 OVERRIDE; | 67 OVERRIDE; |
| 71 virtual int GetNumDisplays() const OVERRIDE; | 68 virtual int GetNumDisplays() const OVERRIDE; |
| 72 virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE; | 69 virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE; |
| 73 virtual gfx::Display GetDisplayNearestWindow( | 70 virtual gfx::Display GetDisplayNearestWindow( |
| 74 gfx::NativeView view) const OVERRIDE; | 71 gfx::NativeView view) const OVERRIDE; |
| 75 virtual gfx::Display GetDisplayNearestPoint( | 72 virtual gfx::Display GetDisplayNearestPoint( |
| 76 const gfx::Point& point) const OVERRIDE; | 73 const gfx::Point& point) const OVERRIDE; |
| 77 virtual gfx::Display GetDisplayMatching( | 74 virtual gfx::Display GetDisplayMatching( |
| 78 const gfx::Rect& match_rect) const OVERRIDE; | 75 const gfx::Rect& match_rect) const OVERRIDE; |
| 79 virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; | 76 virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; |
| 80 virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE; | 77 virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE; |
| 81 virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE; | 78 virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE; |
| 82 | 79 |
| 83 private: | 80 private: |
| 81 friend class Shell; | |
|
Jun Mukai
2014/01/15 19:20:15
I don't think Shell is necessarily a friend class.
oshima
2014/01/15 19:42:51
Thank you for the catch. removed.
| |
| 82 friend class internal::DisplayManager; | |
| 83 | |
| 84 // Notifies observers of display configuration changes. | |
| 85 void NotifyBoundsChanged(const gfx::Display& display); | |
| 86 void NotifyDisplayAdded(const gfx::Display& display); | |
| 87 void NotifyDisplayRemoved(const gfx::Display& display); | |
| 88 | |
| 89 // Creates a screen that can be used during shutdown. | |
| 90 // It simply has a copy of the displays. | |
| 91 gfx::Screen* CloneForShutdown(); | |
| 92 | |
| 84 ObserverList<gfx::DisplayObserver> observers_; | 93 ObserverList<gfx::DisplayObserver> observers_; |
| 85 | 94 |
| 86 DISALLOW_COPY_AND_ASSIGN(ScreenAsh); | 95 DISALLOW_COPY_AND_ASSIGN(ScreenAsh); |
| 87 }; | 96 }; |
| 88 | 97 |
| 89 } // namespace ash | 98 } // namespace ash |
| 90 | 99 |
| 91 #endif // ASH_SCREEN_ASH_H_ | 100 #endif // ASH_DISPLAY_SCREEN_ASH_H_ |
| OLD | NEW |