| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/wm/core/cursor_manager.h" | 5 #include "ui/wm/core/cursor_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 cursor_lock_count_(0), | 80 cursor_lock_count_(0), |
| 81 current_state_(new internal::CursorState), | 81 current_state_(new internal::CursorState), |
| 82 state_on_unlock_(new internal::CursorState) { | 82 state_on_unlock_(new internal::CursorState) { |
| 83 // Restore the last cursor visibility state. | 83 // Restore the last cursor visibility state. |
| 84 current_state_->SetVisible(last_cursor_visibility_state_); | 84 current_state_->SetVisible(last_cursor_visibility_state_); |
| 85 } | 85 } |
| 86 | 86 |
| 87 CursorManager::~CursorManager() { | 87 CursorManager::~CursorManager() { |
| 88 } | 88 } |
| 89 | 89 |
| 90 // static |
| 91 void CursorManager::ResetCursorVisibilityStateForTest() { |
| 92 last_cursor_visibility_state_ = true; |
| 93 } |
| 94 |
| 90 void CursorManager::SetCursor(gfx::NativeCursor cursor) { | 95 void CursorManager::SetCursor(gfx::NativeCursor cursor) { |
| 91 state_on_unlock_->set_cursor(cursor); | 96 state_on_unlock_->set_cursor(cursor); |
| 92 if (cursor_lock_count_ == 0 && | 97 if (cursor_lock_count_ == 0 && |
| 93 GetCursor() != state_on_unlock_->cursor()) { | 98 GetCursor() != state_on_unlock_->cursor()) { |
| 94 delegate_->SetCursor(state_on_unlock_->cursor(), this); | 99 delegate_->SetCursor(state_on_unlock_->cursor(), this); |
| 95 } | 100 } |
| 96 } | 101 } |
| 97 | 102 |
| 98 gfx::NativeCursor CursorManager::GetCursor() const { | 103 gfx::NativeCursor CursorManager::GetCursor() const { |
| 99 return current_state_->cursor(); | 104 return current_state_->cursor(); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 222 |
| 218 void CursorManager::CommitCursorSet(ui::CursorSetType cursor_set) { | 223 void CursorManager::CommitCursorSet(ui::CursorSetType cursor_set) { |
| 219 current_state_->set_cursor_set(cursor_set); | 224 current_state_->set_cursor_set(cursor_set); |
| 220 } | 225 } |
| 221 | 226 |
| 222 void CursorManager::CommitMouseEventsEnabled(bool enabled) { | 227 void CursorManager::CommitMouseEventsEnabled(bool enabled) { |
| 223 current_state_->SetMouseEventsEnabled(enabled); | 228 current_state_->SetMouseEventsEnabled(enabled); |
| 224 } | 229 } |
| 225 | 230 |
| 226 } // namespace wm | 231 } // namespace wm |
| OLD | NEW |