Chromium Code Reviews| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 OnCursorVisibilityChanged(false)); | 125 OnCursorVisibilityChanged(false)); |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 bool CursorManager::IsCursorVisible() const { | 129 bool CursorManager::IsCursorVisible() const { |
| 130 return current_state_->visible(); | 130 return current_state_->visible(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void CursorManager::SetCursorSet(ui::CursorSetType cursor_set) { | 133 void CursorManager::SetCursorSet(ui::CursorSetType cursor_set) { |
| 134 state_on_unlock_->set_cursor_set(cursor_set); | 134 state_on_unlock_->set_cursor_set(cursor_set); |
| 135 if (GetCursorSet() != state_on_unlock_->cursor_set()) | 135 if (GetCursorSet() != state_on_unlock_->cursor_set()) { |
| 136 delegate_->SetCursorSet(state_on_unlock_->cursor_set(), this); | 136 delegate_->SetCursorSet(state_on_unlock_->cursor_set(), this); |
| 137 FOR_EACH_OBSERVER(aura::client::CursorClientObserver, observers_, | |
| 138 OnCursorSetChanged(cursor_set)); | |
| 139 } | |
| 137 } | 140 } |
| 138 | 141 |
| 139 ui::CursorSetType CursorManager::GetCursorSet() const { | 142 ui::CursorSetType CursorManager::GetCursorSet() const { |
| 140 return current_state_->cursor_set(); | 143 return current_state_->cursor_set(); |
| 141 } | 144 } |
| 142 | 145 |
| 143 void CursorManager::EnableMouseEvents() { | 146 void CursorManager::EnableMouseEvents() { |
| 144 state_on_unlock_->SetMouseEventsEnabled(true); | 147 state_on_unlock_->SetMouseEventsEnabled(true); |
| 145 if (cursor_lock_count_ == 0 && | 148 if (cursor_lock_count_ == 0 && |
| 146 IsMouseEventsEnabled() != state_on_unlock_->mouse_events_enabled()) { | 149 IsMouseEventsEnabled() != state_on_unlock_->mouse_events_enabled()) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 } | 197 } |
| 195 | 198 |
| 196 void CursorManager::AddObserver( | 199 void CursorManager::AddObserver( |
| 197 aura::client::CursorClientObserver* observer) { | 200 aura::client::CursorClientObserver* observer) { |
| 198 observers_.AddObserver(observer); | 201 observers_.AddObserver(observer); |
| 199 } | 202 } |
| 200 | 203 |
| 201 void CursorManager::RemoveObserver( | 204 void CursorManager::RemoveObserver( |
| 202 aura::client::CursorClientObserver* observer) { | 205 aura::client::CursorClientObserver* observer) { |
| 203 observers_.RemoveObserver(observer); | 206 observers_.RemoveObserver(observer); |
| 207 LOG(ERROR) << observers_.might_have_observers(); | |
|
sky
2016/06/20 15:27:51
remove this.
yoshiki
2016/06/28 02:12:42
Done.
| |
| 204 } | 208 } |
| 205 | 209 |
| 206 bool CursorManager::ShouldHideCursorOnKeyEvent( | 210 bool CursorManager::ShouldHideCursorOnKeyEvent( |
| 207 const ui::KeyEvent& event) const { | 211 const ui::KeyEvent& event) const { |
| 208 return false; | 212 return false; |
| 209 } | 213 } |
| 210 | 214 |
| 211 void CursorManager::CommitCursor(gfx::NativeCursor cursor) { | 215 void CursorManager::CommitCursor(gfx::NativeCursor cursor) { |
| 212 current_state_->set_cursor(cursor); | 216 current_state_->set_cursor(cursor); |
| 213 } | 217 } |
| 214 | 218 |
| 215 void CursorManager::CommitVisibility(bool visible) { | 219 void CursorManager::CommitVisibility(bool visible) { |
| 216 // TODO(tdanderson): Find a better place for this so we don't | 220 // TODO(tdanderson): Find a better place for this so we don't |
| 217 // notify the observers more than is necessary. | 221 // notify the observers more than is necessary. |
| 218 FOR_EACH_OBSERVER(aura::client::CursorClientObserver, observers_, | 222 FOR_EACH_OBSERVER(aura::client::CursorClientObserver, observers_, |
| 219 OnCursorVisibilityChanged(visible)); | 223 OnCursorVisibilityChanged(visible)); |
| 220 current_state_->SetVisible(visible); | 224 current_state_->SetVisible(visible); |
| 221 } | 225 } |
| 222 | 226 |
| 223 void CursorManager::CommitCursorSet(ui::CursorSetType cursor_set) { | 227 void CursorManager::CommitCursorSet(ui::CursorSetType cursor_set) { |
| 224 current_state_->set_cursor_set(cursor_set); | 228 current_state_->set_cursor_set(cursor_set); |
| 225 } | 229 } |
| 226 | 230 |
| 227 void CursorManager::CommitMouseEventsEnabled(bool enabled) { | 231 void CursorManager::CommitMouseEventsEnabled(bool enabled) { |
| 228 current_state_->SetMouseEventsEnabled(enabled); | 232 current_state_->SetMouseEventsEnabled(enabled); |
| 229 } | 233 } |
| 230 | 234 |
| 231 } // namespace wm | 235 } // namespace wm |
| OLD | NEW |