| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/cursor_manager.h" | 5 #include "ash/wm/cursor_manager.h" |
| 6 | 6 |
| 7 #include "ash/wm/cursor_delegate.h" | 7 #include "ash/wm/cursor_delegate.h" |
| 8 #include "ash/wm/image_cursors.h" | 8 #include "ash/wm/image_cursors.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 cursor_lock_count_++; | 29 cursor_lock_count_++; |
| 30 } | 30 } |
| 31 | 31 |
| 32 void CursorManager::UnlockCursor() { | 32 void CursorManager::UnlockCursor() { |
| 33 cursor_lock_count_--; | 33 cursor_lock_count_--; |
| 34 DCHECK_GE(cursor_lock_count_, 0); | 34 DCHECK_GE(cursor_lock_count_, 0); |
| 35 if (cursor_lock_count_ == 0) { | 35 if (cursor_lock_count_ == 0) { |
| 36 if (did_cursor_change_) { | 36 if (did_cursor_change_) { |
| 37 did_cursor_change_ = false; | 37 did_cursor_change_ = false; |
| 38 if (delegate_) | 38 if (delegate_) |
| 39 delegate_->SetCursor(cursor_to_set_on_unlock_); | 39 SetCursorInternal(cursor_to_set_on_unlock_); |
| 40 } | 40 } |
| 41 did_cursor_change_ = false; | 41 did_cursor_change_ = false; |
| 42 cursor_to_set_on_unlock_ = gfx::kNullCursor; | 42 cursor_to_set_on_unlock_ = gfx::kNullCursor; |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 void CursorManager::SetCursor(gfx::NativeCursor cursor) { | 46 void CursorManager::SetCursor(gfx::NativeCursor cursor) { |
| 47 if (cursor_lock_count_ == 0) { | 47 if (cursor_lock_count_ == 0) { |
| 48 if (delegate_) | 48 if (delegate_) |
| 49 SetCursorInternal(cursor); | 49 SetCursorInternal(cursor); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 73 void CursorManager::SetCursorInternal(gfx::NativeCursor cursor) { | 73 void CursorManager::SetCursorInternal(gfx::NativeCursor cursor) { |
| 74 DCHECK(delegate_); | 74 DCHECK(delegate_); |
| 75 current_cursor_ = cursor; | 75 current_cursor_ = cursor; |
| 76 image_cursors_->SetPlatformCursor(¤t_cursor_); | 76 image_cursors_->SetPlatformCursor(¤t_cursor_); |
| 77 current_cursor_.set_device_scale_factor( | 77 current_cursor_.set_device_scale_factor( |
| 78 image_cursors_->GetDeviceScaleFactor()); | 78 image_cursors_->GetDeviceScaleFactor()); |
| 79 delegate_->SetCursor(current_cursor_); | 79 delegate_->SetCursor(current_cursor_); |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace ash | 82 } // namespace ash |
| OLD | NEW |