Index: ash/display/cursor_window_controller.h |
diff --git a/ash/display/cursor_window_controller.h b/ash/display/cursor_window_controller.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e2aece7e8fc791dcbde578b6a0dde4ebf8cb3880 |
--- /dev/null |
+++ b/ash/display/cursor_window_controller.h |
@@ -0,0 +1,77 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_ |
+#define ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_ |
+ |
+#include "ui/aura/window.h" |
+#include "ui/base/cursor/cursor.h" |
+#include "ui/gfx/display.h" |
+ |
+namespace ash { |
+namespace test{ |
+class MirrorWindowTestApi; |
+} |
+ |
+namespace internal { |
+ |
+class CursorWindowDelegate; |
+ |
+// Draws a mouse cursor on a given container window. |
+// When cursor compositing is disabled, CursorWindowController is responsible |
+// to scale and rotate the mouse cursor bitmap to match settings of the |
+// primary display. |
+// When cursor compositing is enabled, just draw the cursor as-is. |
+class CursorWindowController { |
+ public: |
+ CursorWindowController(); |
+ ~CursorWindowController(); |
+ |
+ // Sets cursor compositing mode on/off. |
+ void SetCursorCompositingEnabled(bool enabled); |
+ bool is_cursor_compositing_enabled() const { |
+ return is_cursor_compositing_enabled_; |
+ } |
+ |
+ // Sets the container window for the cursor window controller. |
+ // Closes the cursor window if |container| is NULL. |
+ void SetContainer(aura::Window* container); |
+ |
+ // Sets the bounds of the container in screen coordinates. |
+ void SetBoundsInScreen(const gfx::Rect& bounds); |
+ |
+ // Sets cursor location, shape, set and visibility. |
+ void UpdateLocation(); |
+ void SetCursor(gfx::NativeCursor cursor); |
+ void SetCursorSet(ui::CursorSetType); |
+ void SetVisibility(bool visible); |
+ |
+ private: |
+ friend class test::MirrorWindowTestApi; |
+ |
+ void UpdateCursorImage(); |
+ |
+ bool is_cursor_compositing_enabled_; |
+ aura::Window* container_; |
+ |
+ // The bounds of the container in screen coordinates. |
+ gfx::Rect bounds_in_screen_; |
+ |
+ // The native_type of the cursor, see definitions in cursor.h |
+ int cursor_type_; |
+ |
+ ui::CursorSetType cursor_set_; |
+ gfx::Display::Rotation cursor_rotation_; |
+ gfx::Point hot_point_; |
+ |
+ scoped_ptr<aura::Window> cursor_window_; |
+ scoped_ptr<CursorWindowDelegate> delegate_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(CursorWindowController); |
+}; |
+ |
+} // namespace internal |
+} // namespace ash |
+ |
+#endif // ASH_DISPLAY_CURSOR_WINDOW_CONTROLLER_H_ |