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

Unified Diff: ui/views/corewm/cursor_manager.cc

Issue 111043002: Cursor state should be global for desktop Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test added Created 7 years 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
Index: ui/views/corewm/cursor_manager.cc
diff --git a/ui/views/corewm/cursor_manager.cc b/ui/views/corewm/cursor_manager.cc
index 97a19ba93c3c9560876de35e4ee529b58c98654f..2335fdd1cbffb9c1d69eb89e847cef1fe48956c2 100644
--- a/ui/views/corewm/cursor_manager.cc
+++ b/ui/views/corewm/cursor_manager.cc
@@ -91,11 +91,15 @@ CursorManager::~CursorManager() {
void CursorManager::SetCursor(gfx::NativeCursor cursor) {
state_on_unlock_->set_cursor(cursor);
if (cursor_lock_count_ == 0 &&
- GetCurrentCursor() != state_on_unlock_->cursor()) {
+ GetCursor() != state_on_unlock_->cursor()) {
delegate_->SetCursor(state_on_unlock_->cursor(), this);
}
}
+gfx::NativeCursor CursorManager::GetCursor() const {
+ return current_state_->cursor();
+}
+
void CursorManager::ShowCursor() {
state_on_unlock_->SetVisible(true);
if (cursor_lock_count_ == 0 &&
@@ -122,21 +126,21 @@ bool CursorManager::IsCursorVisible() const {
void CursorManager::SetScale(float scale) {
state_on_unlock_->set_scale(scale);
- if (GetCurrentScale() != state_on_unlock_->scale())
+ if (GetScale() != state_on_unlock_->scale())
delegate_->SetScale(state_on_unlock_->scale(), this);
}
+float CursorManager::GetScale() const {
+ return current_state_->scale();
+}
+
void CursorManager::SetCursorSet(ui::CursorSetType cursor_set) {
state_on_unlock_->set_cursor_set(cursor_set);
- if (GetCurrentCursorSet() != state_on_unlock_->cursor_set())
+ if (GetCursorSet() != state_on_unlock_->cursor_set())
delegate_->SetCursorSet(state_on_unlock_->cursor_set(), this);
}
-float CursorManager::GetCurrentScale() const {
- return current_state_->scale();
-}
-
-ui::CursorSetType CursorManager::GetCurrentCursorSet() const {
+ui::CursorSetType CursorManager::GetCursorSet() const {
return current_state_->cursor_set();
}
@@ -176,7 +180,7 @@ void CursorManager::UnlockCursor() {
if (cursor_lock_count_ > 0)
return;
- if (GetCurrentCursor() != state_on_unlock_->cursor()) {
+ if (GetCursor() != state_on_unlock_->cursor()) {
delegate_->SetCursor(state_on_unlock_->cursor(), this);
}
if (IsMouseEventsEnabled() != state_on_unlock_->mouse_events_enabled()) {
@@ -203,23 +207,13 @@ void CursorManager::RemoveObserver(
observers_.RemoveObserver(observer);
}
-gfx::NativeCursor CursorManager::GetCurrentCursor() const {
- return current_state_->cursor();
-}
-
-bool CursorManager::GetCurrentVisibility() const {
- return current_state_->visible();
-}
-
-bool CursorManager::GetMouseEventsEnabled() const {
- return current_state_->mouse_events_enabled();
-}
-
void CursorManager::CommitCursor(gfx::NativeCursor cursor) {
current_state_->set_cursor(cursor);
}
void CursorManager::CommitVisibility(bool visible) {
+ // TODO(tdanderson): Find a better place for this so we don't
+ // notify the observers more than is necessary.
FOR_EACH_OBSERVER(aura::client::CursorClientObserver, observers_,
OnCursorVisibilityChanged(visible));
current_state_->SetVisible(visible);

Powered by Google App Engine
This is Rietveld 408576698