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> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "ui/aura/client/cursor_client_observer.h" | 10 #include "ui/aura/client/cursor_client_observer.h" |
9 #include "ui/wm/core/native_cursor_manager.h" | 11 #include "ui/wm/core/native_cursor_manager.h" |
10 #include "ui/wm/core/native_cursor_manager_delegate.h" | 12 #include "ui/wm/core/native_cursor_manager_delegate.h" |
11 | 13 |
12 namespace wm { | 14 namespace wm { |
13 | 15 |
14 namespace internal { | 16 namespace internal { |
15 | 17 |
16 // Represents the cursor state which is composed of cursor type, visibility, and | 18 // Represents the cursor state which is composed of cursor type, visibility, and |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 66 |
65 // The visibility to set when mouse events are enabled. | 67 // The visibility to set when mouse events are enabled. |
66 bool visible_on_mouse_events_enabled_; | 68 bool visible_on_mouse_events_enabled_; |
67 | 69 |
68 DISALLOW_COPY_AND_ASSIGN(CursorState); | 70 DISALLOW_COPY_AND_ASSIGN(CursorState); |
69 }; | 71 }; |
70 | 72 |
71 } // namespace internal | 73 } // namespace internal |
72 | 74 |
73 CursorManager::CursorManager(scoped_ptr<NativeCursorManager> delegate) | 75 CursorManager::CursorManager(scoped_ptr<NativeCursorManager> delegate) |
74 : delegate_(delegate.Pass()), | 76 : delegate_(std::move(delegate)), |
75 cursor_lock_count_(0), | 77 cursor_lock_count_(0), |
76 current_state_(new internal::CursorState), | 78 current_state_(new internal::CursorState), |
77 state_on_unlock_(new internal::CursorState) { | 79 state_on_unlock_(new internal::CursorState) {} |
78 } | |
79 | 80 |
80 CursorManager::~CursorManager() { | 81 CursorManager::~CursorManager() { |
81 } | 82 } |
82 | 83 |
83 void CursorManager::SetCursor(gfx::NativeCursor cursor) { | 84 void CursorManager::SetCursor(gfx::NativeCursor cursor) { |
84 state_on_unlock_->set_cursor(cursor); | 85 state_on_unlock_->set_cursor(cursor); |
85 if (cursor_lock_count_ == 0 && | 86 if (cursor_lock_count_ == 0 && |
86 GetCursor() != state_on_unlock_->cursor()) { | 87 GetCursor() != state_on_unlock_->cursor()) { |
87 delegate_->SetCursor(state_on_unlock_->cursor(), this); | 88 delegate_->SetCursor(state_on_unlock_->cursor(), this); |
88 } | 89 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 209 |
209 void CursorManager::CommitCursorSet(ui::CursorSetType cursor_set) { | 210 void CursorManager::CommitCursorSet(ui::CursorSetType cursor_set) { |
210 current_state_->set_cursor_set(cursor_set); | 211 current_state_->set_cursor_set(cursor_set); |
211 } | 212 } |
212 | 213 |
213 void CursorManager::CommitMouseEventsEnabled(bool enabled) { | 214 void CursorManager::CommitMouseEventsEnabled(bool enabled) { |
214 current_state_->SetMouseEventsEnabled(enabled); | 215 current_state_->SetMouseEventsEnabled(enabled); |
215 } | 216 } |
216 | 217 |
217 } // namespace wm | 218 } // namespace wm |
OLD | NEW |