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

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

Issue 2712963003: mustash: Use ui::chromeos::EventRewriter in mus (Closed)
Patch Set: Fix build 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
« no previous file with comments | « services/ui/ws/display_manager.h ('k') | services/ui/ws/display_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "services/ui/ws/display_manager.h" 5 #include "services/ui/ws/display_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
11 #include "services/ui/display/viewport_metrics.h" 11 #include "services/ui/display/viewport_metrics.h"
12 #include "services/ui/ws/cursor_location_manager.h" 12 #include "services/ui/ws/cursor_location_manager.h"
13 #include "services/ui/ws/display.h" 13 #include "services/ui/ws/display.h"
14 #include "services/ui/ws/display_binding.h" 14 #include "services/ui/ws/display_binding.h"
15 #include "services/ui/ws/event_dispatcher.h" 15 #include "services/ui/ws/event_dispatcher.h"
16 #include "services/ui/ws/frame_generator.h" 16 #include "services/ui/ws/frame_generator.h"
17 #include "services/ui/ws/server_window.h" 17 #include "services/ui/ws/server_window.h"
18 #include "services/ui/ws/user_display_manager.h" 18 #include "services/ui/ws/user_display_manager.h"
19 #include "services/ui/ws/user_display_manager_delegate.h" 19 #include "services/ui/ws/user_display_manager_delegate.h"
20 #include "services/ui/ws/user_id_tracker.h" 20 #include "services/ui/ws/user_id_tracker.h"
21 #include "services/ui/ws/window_manager_state.h" 21 #include "services/ui/ws/window_manager_state.h"
22 #include "services/ui/ws/window_manager_window_tree_factory.h" 22 #include "services/ui/ws/window_manager_window_tree_factory.h"
23 #include "services/ui/ws/window_server_delegate.h" 23 #include "services/ui/ws/window_server_delegate.h"
24 #include "services/ui/ws/window_tree.h" 24 #include "services/ui/ws/window_tree.h"
25 #include "ui/events/event_rewriter.h"
26
27 #if defined(OS_CHROMEOS)
28 #include "ui/chromeos/events/event_rewriter_chromeos.h"
29 #endif
25 30
26 namespace ui { 31 namespace ui {
27 namespace ws { 32 namespace ws {
28 33
29 DisplayManager::DisplayManager(WindowServer* window_server, 34 DisplayManager::DisplayManager(WindowServer* window_server,
30 UserIdTracker* user_id_tracker) 35 UserIdTracker* user_id_tracker)
31 // |next_root_id_| is used as the lower bits, so that starting at 0 is 36 // |next_root_id_| is used as the lower bits, so that starting at 0 is
32 // fine. |next_display_id_| is used by itself, so we start at 1 to reserve 37 // fine. |next_display_id_| is used by itself, so we start at 1 to reserve
33 // 0 as invalid. 38 // 0 as invalid.
34 : window_server_(window_server), 39 : window_server_(window_server),
35 user_id_tracker_(user_id_tracker), 40 user_id_tracker_(user_id_tracker),
36 next_root_id_(0) { 41 next_root_id_(0) {
42 #if defined(OS_CHROMEOS)
43 // TODO: http://crbug.com/701468 fix function key preferences and sticky keys.
44 ui::EventRewriterChromeOS::Delegate* delegate = nullptr;
45 ui::EventRewriter* sticky_keys_controller = nullptr;
46 event_rewriter_ = base::MakeUnique<ui::EventRewriterChromeOS>(
47 delegate, sticky_keys_controller);
48 #endif
37 user_id_tracker_->AddObserver(this); 49 user_id_tracker_->AddObserver(this);
38 } 50 }
39 51
40 DisplayManager::~DisplayManager() { 52 DisplayManager::~DisplayManager() {
41 user_id_tracker_->RemoveObserver(this); 53 user_id_tracker_->RemoveObserver(this);
42 DestroyAllDisplays(); 54 DestroyAllDisplays();
43 } 55 }
44 56
45 UserDisplayManager* DisplayManager::GetUserDisplayManager( 57 UserDisplayManager* DisplayManager::GetUserDisplayManager(
46 const UserId& user_id) { 58 const UserId& user_id) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 DCHECK_LT(id, next_root_id_); 167 DCHECK_LT(id, next_root_id_);
156 return RootWindowId(id); 168 return RootWindowId(id);
157 } 169 }
158 170
159 void DisplayManager::OnDisplayAcceleratedWidgetAvailable(Display* display) { 171 void DisplayManager::OnDisplayAcceleratedWidgetAvailable(Display* display) {
160 DCHECK_NE(0u, pending_displays_.count(display)); 172 DCHECK_NE(0u, pending_displays_.count(display));
161 DCHECK_EQ(0u, displays_.count(display)); 173 DCHECK_EQ(0u, displays_.count(display));
162 const bool is_first_display = displays_.empty(); 174 const bool is_first_display = displays_.empty();
163 displays_.insert(display); 175 displays_.insert(display);
164 pending_displays_.erase(display); 176 pending_displays_.erase(display);
177 if (event_rewriter_)
178 display->platform_display()->AddEventRewriter(event_rewriter_.get());
165 window_server_->OnDisplayReady(display, is_first_display); 179 window_server_->OnDisplayReady(display, is_first_display);
166 } 180 }
167 181
168 void DisplayManager::SetHighContrastMode(bool enabled) { 182 void DisplayManager::SetHighContrastMode(bool enabled) {
169 for (Display* display : displays_) { 183 for (Display* display : displays_) {
170 display->platform_display()->GetFrameGenerator()->SetHighContrastMode( 184 display->platform_display()->GetFrameGenerator()->SetHighContrastMode(
171 enabled); 185 enabled);
172 } 186 }
173 } 187 }
174 188
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 DVLOG(3) << "OnPrimaryDisplayChanged: " << primary_display_id; 249 DVLOG(3) << "OnPrimaryDisplayChanged: " << primary_display_id;
236 // TODO(kylechar): Send IPCs to WM clients first. 250 // TODO(kylechar): Send IPCs to WM clients first.
237 251
238 // Send IPCs to any DisplayManagerObservers. 252 // Send IPCs to any DisplayManagerObservers.
239 for (const auto& pair : user_display_managers_) 253 for (const auto& pair : user_display_managers_)
240 pair.second->OnPrimaryDisplayChanged(primary_display_id); 254 pair.second->OnPrimaryDisplayChanged(primary_display_id);
241 } 255 }
242 256
243 } // namespace ws 257 } // namespace ws
244 } // namespace ui 258 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/display_manager.h ('k') | services/ui/ws/display_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698