Update scrollbar layer property tree opacity when it becomes active
[chromium-blink-merge.git] / ash / display / cursor_window_controller.h
blobae6752f2c30dc0c16e4560dc79235e095ef57773
1 // Copyright 2014 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.
5 #ifndef ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_
6 #define ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_
8 #include "ash/ash_export.h"
9 #include "ui/aura/window.h"
10 #include "ui/base/cursor/cursor.h"
11 #include "ui/gfx/display.h"
13 namespace ash {
14 namespace test {
15 class MirrorWindowTestApi;
18 class CursorWindowControllerTest;
19 class CursorWindowDelegate;
21 // Draws a mouse cursor on a given container window.
22 // When cursor compositing is disabled, CursorWindowController is responsible
23 // to scale and rotate the mouse cursor bitmap to match settings of the
24 // primary display.
25 // When cursor compositing is enabled, just draw the cursor as-is.
26 class ASH_EXPORT CursorWindowController {
27 public:
28 CursorWindowController();
29 ~CursorWindowController();
31 bool is_cursor_compositing_enabled() const {
32 return is_cursor_compositing_enabled_;
35 // Sets cursor compositing mode on/off.
36 void SetCursorCompositingEnabled(bool enabled);
38 // Updates the container window for the cursor window controller.
39 void UpdateContainer();
41 // Sets the display on which to draw cursor.
42 // Only applicable when cursor compositing is enabled.
43 void SetDisplay(const gfx::Display& display);
45 // Sets cursor location, shape, set and visibility.
46 void UpdateLocation();
47 void SetCursor(gfx::NativeCursor cursor);
48 void SetCursorSet(ui::CursorSetType);
49 void SetVisibility(bool visible);
51 private:
52 friend class CursorWindowControllerTest;
53 friend class test::MirrorWindowTestApi;
55 // Sets the container window for the cursor window controller.
56 // Closes the cursor window if |container| is NULL.
57 void SetContainer(aura::Window* container);
59 // Sets the bounds of the container in screen coordinates.
60 void SetBoundsInScreen(const gfx::Rect& bounds);
62 // Updates cursor image based on current cursor state.
63 void UpdateCursorImage();
65 // Hides/shows cursor window based on current cursor state.
66 void UpdateCursorVisibility();
68 const gfx::ImageSkia& GetCursorImageForTest() const;
70 bool is_cursor_compositing_enabled_;
71 aura::Window* container_;
73 // The bounds of the container in screen coordinates.
74 gfx::Rect bounds_in_screen_;
76 // The native_type of the cursor, see definitions in cursor.h
77 int cursor_type_;
79 // The last requested cursor visibility.
80 bool visible_;
82 ui::CursorSetType cursor_set_;
83 gfx::Point hot_point_;
85 // The display on which the cursor is drawn.
86 // For mirroring mode, the display is always the primary display.
87 gfx::Display display_;
89 scoped_ptr<aura::Window> cursor_window_;
90 scoped_ptr<CursorWindowDelegate> delegate_;
92 DISALLOW_COPY_AND_ASSIGN(CursorWindowController);
95 } // namespace ash
97 #endif // ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_