| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 SERVICES_UI_WS_USER_DISPLAY_MANAGER_H_ | 5 #ifndef SERVICES_UI_WS_USER_DISPLAY_MANAGER_H_ |
| 6 #define SERVICES_UI_WS_USER_DISPLAY_MANAGER_H_ | 6 #define SERVICES_UI_WS_USER_DISPLAY_MANAGER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "mojo/public/cpp/bindings/binding_set.h" | 12 #include "mojo/public/cpp/bindings/binding_set.h" |
| 13 #include "mojo/public/cpp/bindings/interface_ptr_set.h" | 13 #include "mojo/public/cpp/bindings/interface_ptr_set.h" |
| 14 #include "services/ui/public/interfaces/display.mojom.h" | 14 #include "services/ui/public/interfaces/display_manager.mojom.h" |
| 15 #include "services/ui/ws/user_id.h" | 15 #include "services/ui/ws/user_id.h" |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 class Point; | 18 class Point; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace ui { | 21 namespace ui { |
| 22 namespace ws { | 22 namespace ws { |
| 23 | 23 |
| 24 class Display; | 24 class Display; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 36 UserDisplayManagerDelegate* delegate, | 36 UserDisplayManagerDelegate* delegate, |
| 37 const UserId& user_id); | 37 const UserId& user_id); |
| 38 ~UserDisplayManager() override; | 38 ~UserDisplayManager() override; |
| 39 | 39 |
| 40 // Called when the frame decorations for this user change. | 40 // Called when the frame decorations for this user change. |
| 41 void OnFrameDecorationValuesChanged(); | 41 void OnFrameDecorationValuesChanged(); |
| 42 | 42 |
| 43 void AddDisplayManagerBinding( | 43 void AddDisplayManagerBinding( |
| 44 mojo::InterfaceRequest<mojom::DisplayManager> request); | 44 mojo::InterfaceRequest<mojom::DisplayManager> request); |
| 45 | 45 |
| 46 // Called when something about the display (e.g. pixel-ratio, size) changes. |
| 47 void OnDisplayUpdate(Display* display); |
| 48 |
| 46 // Called by Display prior to |display| being removed and destroyed. | 49 // Called by Display prior to |display| being removed and destroyed. |
| 47 void OnWillDestroyDisplay(Display* display); | 50 void OnWillDestroyDisplay(Display* display); |
| 48 | 51 |
| 52 // Called when the primary display changes. |
| 53 void OnPrimaryDisplayChanged(int64_t primary_display_id); |
| 54 |
| 49 // Called from WindowManagerState when its EventDispatcher receives a mouse | 55 // Called from WindowManagerState when its EventDispatcher receives a mouse |
| 50 // event. | 56 // event. |
| 51 void OnMouseCursorLocationChanged(const gfx::Point& point); | 57 void OnMouseCursorLocationChanged(const gfx::Point& point); |
| 52 | 58 |
| 53 // Called when something about the display (e.g. pixel-ratio, size) changes. | |
| 54 void OnDisplayUpdate(Display* display); | |
| 55 | |
| 56 // Returns a read-only handle to the shared memory which contains the global | 59 // Returns a read-only handle to the shared memory which contains the global |
| 57 // mouse cursor position. Each call returns a new handle. | 60 // mouse cursor position. Each call returns a new handle. |
| 58 mojo::ScopedSharedBufferHandle GetCursorLocationMemory(); | 61 mojo::ScopedSharedBufferHandle GetCursorLocationMemory(); |
| 59 | 62 |
| 60 private: | 63 private: |
| 61 friend class test::UserDisplayManagerTestApi; | 64 friend class test::UserDisplayManagerTestApi; |
| 62 | 65 |
| 63 // Called when a new observer is added. If frame decorations are available | 66 // Called when a new observer is added. If frame decorations are available |
| 64 // notifies the observer immediately. | 67 // notifies the observer immediately. |
| 65 void OnObserverAdded(mojom::DisplayManagerObserver* observer); | 68 void OnObserverAdded(mojom::DisplayManagerObserver* observer); |
| 66 | 69 |
| 70 // Fills in a WsDisplayPtr for |display|. |
| 71 mojom::WsDisplayPtr GetWsDisplayPtr(const Display& display); |
| 72 |
| 67 mojo::Array<mojom::WsDisplayPtr> GetAllDisplays(); | 73 mojo::Array<mojom::WsDisplayPtr> GetAllDisplays(); |
| 68 | 74 |
| 69 // Calls OnDisplays() on |observer|. | 75 // Calls OnDisplays() on |observer|. |
| 70 void CallOnDisplays(mojom::DisplayManagerObserver* observer); | 76 void CallOnDisplays(mojom::DisplayManagerObserver* observer); |
| 71 | 77 |
| 72 // Overriden from mojom::DisplayManager: | 78 // Overriden from mojom::DisplayManager: |
| 73 void AddObserver(mojom::DisplayManagerObserverPtr observer) override; | 79 void AddObserver(mojom::DisplayManagerObserverPtr observer) override; |
| 74 | 80 |
| 75 base::subtle::Atomic32* cursor_location_memory() { | 81 base::subtle::Atomic32* cursor_location_memory() { |
| 76 return reinterpret_cast<base::subtle::Atomic32*>( | 82 return reinterpret_cast<base::subtle::Atomic32*>( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // mojo connection, this data must be read atomically.) | 115 // mojo connection, this data must be read atomically.) |
| 110 mojo::ScopedSharedBufferMapping cursor_location_mapping_; | 116 mojo::ScopedSharedBufferMapping cursor_location_mapping_; |
| 111 | 117 |
| 112 DISALLOW_COPY_AND_ASSIGN(UserDisplayManager); | 118 DISALLOW_COPY_AND_ASSIGN(UserDisplayManager); |
| 113 }; | 119 }; |
| 114 | 120 |
| 115 } // namespace ws | 121 } // namespace ws |
| 116 } // namespace ui | 122 } // namespace ui |
| 117 | 123 |
| 118 #endif // SERVICES_UI_WS_USER_DISPLAY_MANAGER_H_ | 124 #endif // SERVICES_UI_WS_USER_DISPLAY_MANAGER_H_ |
| OLD | NEW |