OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef SERVICES_UI_WS_THREADED_IMAGE_CURSORS_H_ | |
6 #define SERVICES_UI_WS_THREADED_IMAGE_CURSORS_H_ | |
7 | |
8 #include "base/memory/weak_ptr.h" | |
9 #include "ui/base/cursor/image_cursors.h" | |
10 | |
11 namespace base { | |
12 class SingleThreadTaskRunner; | |
13 } | |
14 | |
15 namespace ui { | |
16 class PlatformWindow; | |
17 | |
18 namespace ws { | |
19 | |
20 // Wrapper around ui::ImageCursors, capable of executing its methods | |
21 // asynchronously via the provided thread task runner. | |
22 class ThreadedImageCursors { | |
23 public: | |
24 ThreadedImageCursors( | |
sky
2017/06/20 22:33:13
explicit.
mfomitchev
2017/06/21 21:22:51
Takes two args now.
| |
25 scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | |
26 ~ThreadedImageCursors(); | |
27 | |
28 void SetDisplay(const display::Display& display, float scale_factor); | |
29 | |
30 // |platform_window| pointer is guaranteed to be alive while this object | |
31 // exists. | |
32 void SetCursor(ui::CursorType cursor_type, | |
33 ui::PlatformWindow* platform_window); | |
34 | |
35 private: | |
36 void SetDisplaySync(const display::Display& display, float scale_factor); | |
37 void SetCursorSync(ui::CursorType cursor_type, | |
38 ui::PlatformWindow* platform_window); | |
39 | |
40 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | |
41 ui::ImageCursors image_cursors_; | |
42 base::WeakPtrFactory<ThreadedImageCursors> weak_ptr_factory_; | |
43 }; | |
sky
2017/06/20 22:33:13
DISALLOW...
mfomitchev
2017/06/21 21:22:51
Done.
| |
44 | |
45 } // namesapce ws | |
46 } // namesapce ui | |
47 | |
48 #endif // SERVICES_UI_WS_THREADED_IMAGE_CURSORS_H_ | |
OLD | NEW |