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

Unified Diff: ui/views/widget/desktop_aura/desktop_cursor_client.cc

Issue 12263050: Rework ash::CursorManager into a corewm object, to share code with desktop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Lables Created 7 years, 10 months 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/widget/desktop_aura/desktop_cursor_client.cc
diff --git a/ui/views/widget/desktop_aura/desktop_cursor_client.cc b/ui/views/widget/desktop_aura/desktop_cursor_client.cc
index b027e74b62ce17aed6933f22d7ca759ea56ba179..fa88ab50fcf2f7025004da206e7f56c504f2120e 100644
--- a/ui/views/widget/desktop_aura/desktop_cursor_client.cc
+++ b/ui/views/widget/desktop_aura/desktop_cursor_client.cc
@@ -11,70 +11,52 @@ namespace views {
DesktopCursorClient::DesktopCursorClient(aura::RootWindow* window)
: root_window_(window),
- cursor_loader_(ui::CursorLoader::Create()),
- current_cursor_(ui::kCursorNone),
- cursor_visible_(true) {
+ cursor_loader_(ui::CursorLoader::Create()) {
}
DesktopCursorClient::~DesktopCursorClient() {
}
-void DesktopCursorClient::SetCursor(gfx::NativeCursor cursor) {
- current_cursor_ = cursor;
- cursor_loader_->SetPlatformCursor(&current_cursor_);
- if (cursor_visible_)
- root_window_->SetCursor(current_cursor_);
-}
+void DesktopCursorClient::SetDeviceScaleFactor(float device_scale_factor) {
+ cursor_loader_->UnloadAll();
+ cursor_loader_->set_device_scale_factor(device_scale_factor);
-void DesktopCursorClient::ShowCursor() {
- SetCursorVisibility(true);
+ DLOG(ERROR) << "Make sure the SetDeviceScaleFactor doesn't spin!";
+ SetCursorInternal(GetCurrentCursor());
}
-void DesktopCursorClient::HideCursor() {
- SetCursorVisibility(false);
-}
+void DesktopCursorClient::SetCursorInternal(gfx::NativeCursor cursor) {
+ gfx::NativeCursor new_cursor = cursor;
+ cursor_loader_->SetPlatformCursor(&new_cursor);
+ CursorController::SetCursorInternal(new_cursor);
-bool DesktopCursorClient::IsCursorVisible() const {
- return cursor_visible_;
+ if (IsCursorVisible())
+ root_window_->SetCursor(new_cursor);
}
-void DesktopCursorClient::EnableMouseEvents() {
- // TODO(mazda): Implement this.
- NOTIMPLEMENTED();
-}
+void DesktopCursorClient::SetCursorVisibility(bool visible) {
+ CursorController::SetCursorVisibility(visible);
-void DesktopCursorClient::DisableMouseEvents() {
- // TODO(mazda): Implement this.
- NOTIMPLEMENTED();
-}
+ if (visible) {
+ SetCursorInternal(GetCurrentCursor());
+ } else {
+ gfx::NativeCursor invisible_cursor(ui::kCursorNone);
+ cursor_loader_->SetPlatformCursor(&invisible_cursor);
+ root_window_->SetCursor(invisible_cursor);
+ }
-bool DesktopCursorClient::IsMouseEventsEnabled() const {
- // TODO(mazda): Implement this.
- NOTIMPLEMENTED();
- return true;
+ root_window_->OnCursorVisibilityChanged(visible);
}
-void DesktopCursorClient::SetDeviceScaleFactor(float device_scale_factor) {
- cursor_loader_->UnloadAll();
- cursor_loader_->set_device_scale_factor(device_scale_factor);
-}
+void DesktopCursorClient::SetMouseEventsEnabled(bool enabled) {
+ CursorController::SetMouseEventsEnabled(enabled);
-void DesktopCursorClient::LockCursor() {
- // TODO(mazda): Implement this.
- NOTIMPLEMENTED();
-}
+ // TODO(erg): In the ash version, we set the last mouse location on Env. I'm
+ // not sure this concept makes sense on the desktop.
-void DesktopCursorClient::UnlockCursor() {
- // TODO(mazda): Implement this.
- NOTIMPLEMENTED();
-}
+ SetCursorVisibility(IsCursorVisible());
-void DesktopCursorClient::SetCursorVisibility(bool visible) {
- if (cursor_visible_ == visible)
- return;
- cursor_visible_ = visible;
- root_window_->SetCursor(current_cursor_);
- root_window_->OnCursorVisibilityChanged(visible);
+ root_window_->OnMouseEventsEnableStateChanged(enabled);
}
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698