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

Unified Diff: ui/views/corewm/cursor_controller.h

Issue 12263050: Rework ash::CursorManager into a corewm object, to share code with desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Lables Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/corewm/cursor_controller.h
diff --git a/ash/wm/cursor_manager.h b/ui/views/corewm/cursor_controller.h
similarity index 50%
copy from ash/wm/cursor_manager.h
copy to ui/views/corewm/cursor_controller.h
index 774e4505082a66cde4a07f648688303a4ff82f65..f6a7bb999b1af3801c63f29af9196805f3b6dd24 100644
--- a/ash/wm/cursor_manager.h
+++ b/ui/views/corewm/cursor_controller.h
@@ -1,37 +1,31 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2013 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_WM_CURSOR_MANAGER_H_
-#define ASH_WM_CURSOR_MANAGER_H_
+#ifndef UI_VIEWS_COREWM_CURSOR_CONTROLLER_H_
+#define UI_VIEWS_COREWM_CURSOR_CONTROLLER_H_
-#include "ash/ash_export.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "ui/aura/client/cursor_client.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/point.h"
+#include "ui/views/views_export.h"
-namespace ash {
+namespace views {
+namespace corewm {
namespace internal {
class CursorState;
}
-namespace test {
-class CursorManagerTestApi;
-}
-
-class ImageCursors;
-
-// This class controls the visibility and the type of the cursor.
-// The cursor type can be locked so that the type stays the same
-// until it's unlocked.
-class ASH_EXPORT CursorManager : public aura::client::CursorClient {
+// This class controls the visibility and the type of the cursor. The cursor
+// type can be locked so that the type stays the same until it's unlocked.
+class VIEWS_EXPORT CursorController : public aura::client::CursorClient {
public:
- CursorManager();
- virtual ~CursorManager();
+ CursorController();
+ virtual ~CursorController();
bool is_cursor_locked() const { return cursor_lock_count_ > 0; }
@@ -43,38 +37,45 @@ class ASH_EXPORT CursorManager : public aura::client::CursorClient {
virtual void EnableMouseEvents() OVERRIDE;
virtual void DisableMouseEvents() OVERRIDE;
virtual bool IsMouseEventsEnabled() const OVERRIDE;
- virtual void SetDeviceScaleFactor(float device_scale_factor) OVERRIDE;
virtual void LockCursor() OVERRIDE;
virtual void UnlockCursor() OVERRIDE;
- private:
- friend class test::CursorManagerTestApi;
-
- void SetCursorInternal(gfx::NativeCursor cursor);
- void SetCursorVisibility(bool visible);
- void SetMouseEventsEnabled(bool enabled);
-
+ protected:
// Returns the current cursor.
gfx::NativeCursor GetCurrentCursor() const;
+ // Subclasses of CursorController control the actual assignment of cursors
+ // through the following template methods.
+
+ // Called to set the current cursor. Subclasses that need to set platform
+ // state should call the base method from their override after mutating their
+ // incoming cursor with their platform state.
+ virtual void SetCursorInternal(gfx::NativeCursor cursor);
+
+ // Called to set the visibility. Subclasses should call the base method first
+ // and then do platform visibility mutation.
+ virtual void SetCursorVisibility(bool visible);
+
+ // Called to set whether mouse events are enabled. Subclasses should call the
+ // base method first and then restore whatever state is necessary on their
+ // platform.
+ virtual void SetMouseEventsEnabled(bool enabled);
+
+ private:
// Number of times LockCursor() has been invoked without a corresponding
// UnlockCursor().
int cursor_lock_count_;
- // The cursor location where the cursor was disabled.
- gfx::Point disabled_cursor_location_;
-
// The current state of the cursor.
scoped_ptr<internal::CursorState> current_state_;
// The cursor state to restore when the cursor is unlocked.
scoped_ptr<internal::CursorState> state_on_unlock_;
- scoped_ptr<ImageCursors> image_cursors_;
-
- DISALLOW_COPY_AND_ASSIGN(CursorManager);
+ DISALLOW_COPY_AND_ASSIGN(CursorController);
};
-} // namespace ash
+} // namespace corewm
+} // namespace views
-#endif // UI_AURA_CURSOR_MANAGER_H_
+#endif // UI_VIEWS_COREWM_CURSOR_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698