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

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

Issue 2378883002: mus ws: Consistently use mojom::Cursor instead of int32_t. (Closed)
Patch Set: Created 4 years, 2 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.h ('k') | services/ui/ws/drag_controller.h » ('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 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 #include "services/ui/ws/display.h" 5 #include "services/ui/ws/display.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/debug/debugger.h" 11 #include "base/debug/debugger.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "mojo/common/common_type_converters.h" 13 #include "mojo/common/common_type_converters.h"
14 #include "services/shell/public/interfaces/connector.mojom.h" 14 #include "services/shell/public/interfaces/connector.mojom.h"
15 #include "services/ui/common/types.h" 15 #include "services/ui/common/types.h"
16 #include "services/ui/public/interfaces/cursor.mojom.h"
16 #include "services/ui/ws/display_binding.h" 17 #include "services/ui/ws/display_binding.h"
17 #include "services/ui/ws/display_manager.h" 18 #include "services/ui/ws/display_manager.h"
18 #include "services/ui/ws/focus_controller.h" 19 #include "services/ui/ws/focus_controller.h"
19 #include "services/ui/ws/platform_display.h" 20 #include "services/ui/ws/platform_display.h"
20 #include "services/ui/ws/platform_display_init_params.h" 21 #include "services/ui/ws/platform_display_init_params.h"
21 #include "services/ui/ws/user_activity_monitor.h" 22 #include "services/ui/ws/user_activity_monitor.h"
22 #include "services/ui/ws/window_manager_display_root.h" 23 #include "services/ui/ws/window_manager_display_root.h"
23 #include "services/ui/ws/window_manager_state.h" 24 #include "services/ui/ws/window_manager_state.h"
24 #include "services/ui/ws/window_manager_window_tree_factory.h" 25 #include "services/ui/ws/window_manager_window_tree_factory.h"
25 #include "services/ui/ws/window_server.h" 26 #include "services/ui/ws/window_server.h"
26 #include "services/ui/ws/window_server_delegate.h" 27 #include "services/ui/ws/window_server_delegate.h"
27 #include "services/ui/ws/window_tree.h" 28 #include "services/ui/ws/window_tree.h"
28 #include "services/ui/ws/window_tree_binding.h" 29 #include "services/ui/ws/window_tree_binding.h"
29 #include "ui/base/cursor/cursor.h" 30 #include "ui/base/cursor/cursor.h"
30 31
31 namespace ui { 32 namespace ui {
32 namespace ws { 33 namespace ws {
33 34
34 Display::Display(WindowServer* window_server, 35 Display::Display(WindowServer* window_server,
35 const PlatformDisplayInitParams& platform_display_init_params) 36 const PlatformDisplayInitParams& platform_display_init_params)
36 : window_server_(window_server), 37 : window_server_(window_server),
37 platform_display_(PlatformDisplay::Create(platform_display_init_params)), 38 platform_display_(PlatformDisplay::Create(platform_display_init_params)),
38 last_cursor_(ui::kCursorNone) { 39 last_cursor_(mojom::Cursor::CURSOR_NULL) {
39 platform_display_->Init(this); 40 platform_display_->Init(this);
40 41
41 window_server_->window_manager_window_tree_factory_set()->AddObserver(this); 42 window_server_->window_manager_window_tree_factory_set()->AddObserver(this);
42 window_server_->user_id_tracker()->AddObserver(this); 43 window_server_->user_id_tracker()->AddObserver(this);
43 } 44 }
44 45
45 Display::~Display() { 46 Display::~Display() {
46 window_server_->user_id_tracker()->RemoveObserver(this); 47 window_server_->user_id_tracker()->RemoveObserver(this);
47 48
48 window_server_->window_manager_window_tree_factory_set()->RemoveObserver( 49 window_server_->window_manager_window_tree_factory_set()->RemoveObserver(
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 void Display::OnWillDestroyTree(WindowTree* tree) { 214 void Display::OnWillDestroyTree(WindowTree* tree) {
214 for (auto it = window_manager_display_root_map_.begin(); 215 for (auto it = window_manager_display_root_map_.begin();
215 it != window_manager_display_root_map_.end(); ++it) { 216 it != window_manager_display_root_map_.end(); ++it) {
216 if (it->second->window_manager_state()->window_tree() == tree) { 217 if (it->second->window_manager_state()->window_tree() == tree) {
217 window_manager_display_root_map_.erase(it); 218 window_manager_display_root_map_.erase(it);
218 break; 219 break;
219 } 220 }
220 } 221 }
221 } 222 }
222 223
223 void Display::UpdateNativeCursor(int32_t cursor_id) { 224 void Display::UpdateNativeCursor(mojom::Cursor cursor_id) {
224 if (cursor_id != last_cursor_) { 225 if (cursor_id != last_cursor_) {
225 platform_display_->SetCursorById(cursor_id); 226 platform_display_->SetCursorById(cursor_id);
226 last_cursor_ = cursor_id; 227 last_cursor_ = cursor_id;
227 } 228 }
228 } 229 }
229 230
230 void Display::SetSize(const gfx::Size& size) { 231 void Display::SetSize(const gfx::Size& size) {
231 platform_display_->SetViewportSize(size); 232 platform_display_->SetViewportSize(size);
232 } 233 }
233 234
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 } 431 }
431 432
432 void Display::OnWindowManagerWindowTreeFactoryReady( 433 void Display::OnWindowManagerWindowTreeFactoryReady(
433 WindowManagerWindowTreeFactory* factory) { 434 WindowManagerWindowTreeFactory* factory) {
434 if (!binding_) 435 if (!binding_)
435 CreateWindowManagerDisplayRootFromFactory(factory); 436 CreateWindowManagerDisplayRootFromFactory(factory);
436 } 437 }
437 438
438 } // namespace ws 439 } // namespace ws
439 } // namespace ui 440 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ws/display.h ('k') | services/ui/ws/drag_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698