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