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

Unified Diff: ash/wm/cursor_manager.cc

Issue 10919135: Move ash specific cursor code to CursorManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 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
« no previous file with comments | « ash/wm/cursor_manager.h ('k') | ash/wm/image_cursors.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/cursor_manager.cc
diff --git a/ash/wm/cursor_manager.cc b/ash/wm/cursor_manager.cc
index 1ebc72bfc7196f67fa71b3bda4523b0aafae1960..3afee4b20d848e9d1b29b0ecce034e2d228d4523 100644
--- a/ash/wm/cursor_manager.cc
+++ b/ash/wm/cursor_manager.cc
@@ -5,8 +5,10 @@
#include "ash/wm/cursor_manager.h"
#include "ash/wm/cursor_delegate.h"
+#include "ash/wm/image_cursors.h"
#include "base/logging.h"
#include "ui/aura/env.h"
+#include "ui/base/cursor/cursor.h"
namespace ash {
@@ -15,7 +17,9 @@ CursorManager::CursorManager()
cursor_lock_count_(0),
did_cursor_change_(false),
cursor_to_set_on_unlock_(0),
- cursor_visible_(true) {
+ cursor_visible_(true),
+ current_cursor_(ui::kCursorNone),
+ image_cursors_(new ImageCursors) {
}
CursorManager::~CursorManager() {
@@ -42,7 +46,7 @@ void CursorManager::UnlockCursor() {
void CursorManager::SetCursor(gfx::NativeCursor cursor) {
if (cursor_lock_count_ == 0) {
if (delegate_)
- delegate_->SetCursor(cursor);
+ SetCursorInternal(cursor);
} else {
cursor_to_set_on_unlock_ = cursor;
did_cursor_change_ = true;
@@ -59,4 +63,20 @@ bool CursorManager::IsCursorVisible() const {
return cursor_visible_;
}
+void CursorManager::SetDeviceScaleFactor(float device_scale_factor) {
+ if (image_cursors_->GetDeviceScaleFactor() == device_scale_factor)
+ return;
+ image_cursors_->SetDeviceScaleFactor(device_scale_factor);
+ SetCursorInternal(current_cursor_);
+}
+
+void CursorManager::SetCursorInternal(gfx::NativeCursor cursor) {
+ DCHECK(delegate_);
+ current_cursor_ = cursor;
+ image_cursors_->SetPlatformCursor(&current_cursor_);
+ current_cursor_.set_device_scale_factor(
+ image_cursors_->GetDeviceScaleFactor());
+ delegate_->SetCursor(current_cursor_);
+}
+
} // namespace ash
« no previous file with comments | « ash/wm/cursor_manager.h ('k') | ash/wm/image_cursors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698