Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: services/ui/ws/display_manager.h

Issue 2712963003: mustash: Use ui::chromeos::EventRewriter in mus (Closed)
Patch Set: Address review issues Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_DISPLAY_MANAGER_H_ 5 #ifndef SERVICES_UI_WS_DISPLAY_MANAGER_H_
6 #define SERVICES_UI_WS_DISPLAY_MANAGER_H_ 6 #define SERVICES_UI_WS_DISPLAY_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "services/ui/display/screen_manager_delegate.h" 13 #include "services/ui/display/screen_manager_delegate.h"
14 #include "services/ui/ws/ids.h" 14 #include "services/ui/ws/ids.h"
15 #include "services/ui/ws/user_id.h" 15 #include "services/ui/ws/user_id.h"
16 #include "services/ui/ws/user_id_tracker_observer.h" 16 #include "services/ui/ws/user_id_tracker_observer.h"
17 #include "ui/display/display.h" 17 #include "ui/display/display.h"
18 18
19 namespace ui { 19 namespace ui {
20 class EventRewriter;
20 namespace ws { 21 namespace ws {
21 22
22 class CursorLocationManager; 23 class CursorLocationManager;
23 class Display; 24 class Display;
24 class ServerWindow; 25 class ServerWindow;
25 class UserDisplayManager; 26 class UserDisplayManager;
26 class UserIdTracker; 27 class UserIdTracker;
27 class WindowManagerDisplayRoot; 28 class WindowManagerDisplayRoot;
28 class WindowServer; 29 class WindowServer;
29 30
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 const ServerWindow* window) const; 68 const ServerWindow* window) const;
68 // TODO(sky): constness here is wrong! fix! 69 // TODO(sky): constness here is wrong! fix!
69 WindowManagerDisplayRoot* GetWindowManagerDisplayRoot( 70 WindowManagerDisplayRoot* GetWindowManagerDisplayRoot(
70 const ServerWindow* window); 71 const ServerWindow* window);
71 72
72 bool has_displays() const { return !displays_.empty(); } 73 bool has_displays() const { return !displays_.empty(); }
73 bool has_active_or_pending_displays() const { 74 bool has_active_or_pending_displays() const {
74 return !displays_.empty() || !pending_displays_.empty(); 75 return !displays_.empty() || !pending_displays_.empty();
75 } 76 }
76 77
78 ui::EventRewriter* event_rewriter() { return event_rewriter_.get(); }
79
77 // Returns the id for the next root window (both for the root of a Display 80 // Returns the id for the next root window (both for the root of a Display
78 // as well as the root of WindowManagers). 81 // as well as the root of WindowManagers).
79 WindowId GetAndAdvanceNextRootId(); 82 WindowId GetAndAdvanceNextRootId();
80 83
81 // Called when the AcceleratedWidget is available for |display|. 84 // Called when the AcceleratedWidget is available for |display|.
82 void OnDisplayAcceleratedWidgetAvailable(Display* display); 85 void OnDisplayAcceleratedWidgetAvailable(Display* display);
83 86
84 private: 87 private:
85 // UserIdTrackerObserver: 88 // UserIdTrackerObserver:
86 void OnActiveUserIdChanged(const UserId& previously_active_id, 89 void OnActiveUserIdChanged(const UserId& previously_active_id,
87 const UserId& active_id) override; 90 const UserId& active_id) override;
88 91
89 // display::ScreenManagerDelegate: 92 // display::ScreenManagerDelegate:
90 void OnDisplayAdded(const display::Display& display, 93 void OnDisplayAdded(const display::Display& display,
91 const display::ViewportMetrics& metrics) override; 94 const display::ViewportMetrics& metrics) override;
92 void OnDisplayRemoved(int64_t id) override; 95 void OnDisplayRemoved(int64_t id) override;
93 void OnDisplayModified(const display::Display& display, 96 void OnDisplayModified(const display::Display& display,
94 const display::ViewportMetrics& metrics) override; 97 const display::ViewportMetrics& metrics) override;
95 void OnPrimaryDisplayChanged(int64_t primary_display_id) override; 98 void OnPrimaryDisplayChanged(int64_t primary_display_id) override;
96 99
97 WindowServer* window_server_; 100 WindowServer* window_server_;
98 UserIdTracker* user_id_tracker_; 101 UserIdTracker* user_id_tracker_;
99 102
103 // For rewriting ChromeOS function keys.
104 std::unique_ptr<ui::EventRewriter> event_rewriter_;
sadrul 2017/03/16 05:05:40 Note that we will need to add more rewriters (acce
sky 2017/03/16 16:11:43 Will we need to support rewriters from different s
sadrul 2017/03/16 17:37:26 I actually think those services should simply live
sky 2017/03/16 20:23:07 SGTM. I assume then mus grows an API to turn on th
105
100 // Displays are initially added to |pending_displays_|. When the display is 106 // Displays are initially added to |pending_displays_|. When the display is
101 // initialized it is moved to |displays_|. WindowServer owns the Displays. 107 // initialized it is moved to |displays_|. WindowServer owns the Displays.
102 std::set<Display*> pending_displays_; 108 std::set<Display*> pending_displays_;
103 std::set<Display*> displays_; 109 std::set<Display*> displays_;
104 110
105 std::map<UserId, std::unique_ptr<UserDisplayManager>> user_display_managers_; 111 std::map<UserId, std::unique_ptr<UserDisplayManager>> user_display_managers_;
106 112
107 std::map<UserId, std::unique_ptr<CursorLocationManager>> 113 std::map<UserId, std::unique_ptr<CursorLocationManager>>
108 cursor_location_managers_; 114 cursor_location_managers_;
109 115
110 // ID to use for next root node. 116 // ID to use for next root node.
111 ClientSpecificId next_root_id_; 117 ClientSpecificId next_root_id_;
112 118
113 DISALLOW_COPY_AND_ASSIGN(DisplayManager); 119 DISALLOW_COPY_AND_ASSIGN(DisplayManager);
114 }; 120 };
115 121
116 } // namespace ws 122 } // namespace ws
117 } // namespace ui 123 } // namespace ui
118 124
119 #endif // SERVICES_UI_WS_DISPLAY_MANAGER_H_ 125 #endif // SERVICES_UI_WS_DISPLAY_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698