| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROMECAST_GRAPHICS_CAST_SCREEN_H_ | 5 #ifndef CHROMECAST_GRAPHICS_CAST_SCREEN_H_ |
| 6 #define CHROMECAST_GRAPHICS_CAST_SCREEN_H_ | 6 #define CHROMECAST_GRAPHICS_CAST_SCREEN_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" |
| 8 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "chromecast/public/graphics_types.h" |
| 9 #include "ui/gfx/display.h" | 11 #include "ui/gfx/display.h" |
| 10 #include "ui/gfx/screen.h" | 12 #include "ui/gfx/screen.h" |
| 11 | 13 |
| 12 namespace chromecast { | 14 namespace chromecast { |
| 13 | |
| 14 namespace shell { | 15 namespace shell { |
| 15 class CastBrowserMainParts; | 16 class CastBrowserMainParts; |
| 16 } // namespace shell | 17 } // namespace shell |
| 17 | 18 |
| 18 // CastScreen is Chromecast's own minimal implementation of gfx::Screen. | 19 // CastScreen is Chromecast's own minimal implementation of gfx::Screen. |
| 19 // Right now, it almost exactly duplicates the behavior of aura's TestScreen | 20 // Right now, it almost exactly duplicates the behavior of aura's TestScreen |
| 20 // class for necessary methods. The instantiation of CastScreen occurs in | 21 // class for necessary methods. The instantiation of CastScreen occurs in |
| 21 // CastBrowserMainParts, where its ownership is assigned to CastBrowserProcess. | 22 // CastBrowserMainParts, where its ownership is assigned to CastBrowserProcess. |
| 22 // To then subsequently access CastScreen, see CastBrowerProcess. | 23 // To then subsequently access CastScreen, see CastBrowerProcess. |
| 23 class CastScreen : public gfx::Screen { | 24 class CastScreen : public gfx::Screen { |
| 24 public: | 25 public: |
| 25 ~CastScreen() override; | 26 ~CastScreen() override; |
| 26 | 27 |
| 28 using DisplayResizeCallback = base::Callback<void(const Size&)>; |
| 29 void SetDisplayResizeCallback(const DisplayResizeCallback& cb); |
| 30 |
| 27 // Updates the primary display size. | 31 // Updates the primary display size. |
| 28 void UpdateDisplaySize(const gfx::Size& size); | 32 void UpdateDisplaySize(const gfx::Size& size); |
| 29 | 33 |
| 30 // gfx::Screen overrides: | 34 // gfx::Screen overrides: |
| 31 gfx::Point GetCursorScreenPoint() override; | 35 gfx::Point GetCursorScreenPoint() override; |
| 32 gfx::NativeWindow GetWindowUnderCursor() override; | 36 gfx::NativeWindow GetWindowUnderCursor() override; |
| 33 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; | 37 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; |
| 34 int GetNumDisplays() const override; | 38 int GetNumDisplays() const override; |
| 35 std::vector<gfx::Display> GetAllDisplays() const override; | 39 std::vector<gfx::Display> GetAllDisplays() const override; |
| 36 gfx::Display GetDisplayNearestWindow(gfx::NativeView view) const override; | 40 gfx::Display GetDisplayNearestWindow(gfx::NativeView view) const override; |
| 37 gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override; | 41 gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override; |
| 38 gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) const override; | 42 gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) const override; |
| 39 gfx::Display GetPrimaryDisplay() const override; | 43 gfx::Display GetPrimaryDisplay() const override; |
| 40 void AddObserver(gfx::DisplayObserver* observer) override; | 44 void AddObserver(gfx::DisplayObserver* observer) override; |
| 41 void RemoveObserver(gfx::DisplayObserver* observer) override; | 45 void RemoveObserver(gfx::DisplayObserver* observer) override; |
| 42 | 46 |
| 43 private: | 47 private: |
| 44 CastScreen(); | 48 CastScreen(); |
| 45 | 49 |
| 46 gfx::Display display_; | 50 gfx::Display display_; |
| 51 DisplayResizeCallback display_resize_cb_; |
| 47 | 52 |
| 48 friend class shell::CastBrowserMainParts; | 53 friend class shell::CastBrowserMainParts; |
| 49 | 54 |
| 50 DISALLOW_COPY_AND_ASSIGN(CastScreen); | 55 DISALLOW_COPY_AND_ASSIGN(CastScreen); |
| 51 }; | 56 }; |
| 52 | 57 |
| 53 } // namespace chromecast | 58 } // namespace chromecast |
| 54 | 59 |
| 55 #endif // CHROMECAST_GRAPHICS_CAST_SCREEN_H_ | 60 #endif // CHROMECAST_GRAPHICS_CAST_SCREEN_H_ |
| OLD | NEW |