diff options
author | kelvinp <kelvinp@chromium.org> | 2015-01-06 15:50:07 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-06 23:50:51 +0000 |
commit | efa63e0e545f7984e63bda0fb94a5f02449eca20 (patch) | |
tree | e80486f75485e0738853a4b593158956288f8191 /remoting/host/chromeos | |
parent | 953ad08b2f31268841901155b44564339d78e852 (diff) | |
download | chromium_src-efa63e0e545f7984e63bda0fb94a5f02449eca20.zip chromium_src-efa63e0e545f7984e63bda0fb94a5f02449eca20.tar.gz chromium_src-efa63e0e545f7984e63bda0fb94a5f02449eca20.tar.bz2 |
Hide the cursor on the client when it is hidden on the host
This CL
1. Relaxes the CursorShapeIsValid() check on ClientControlDispatcher
to allow cursors with empty dimensions.
2. Modifies MouseCursorMonitorAura to sends an empty cursor when the
cursor is ui::kCursorNone or when the cursor bitmap cannot be loaded.
3. Initializes the CursorShapeInfo with empty data on the VideoScheduler
as it is a required field.
Review URL: https://codereview.chromium.org/833693002
Cr-Commit-Position: refs/heads/master@{#310175}
Diffstat (limited to 'remoting/host/chromeos')
-rw-r--r-- | remoting/host/chromeos/mouse_cursor_monitor_aura.cc | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/remoting/host/chromeos/mouse_cursor_monitor_aura.cc b/remoting/host/chromeos/mouse_cursor_monitor_aura.cc index ad48f14..f1120aa 100644 --- a/remoting/host/chromeos/mouse_cursor_monitor_aura.cc +++ b/remoting/host/chromeos/mouse_cursor_monitor_aura.cc @@ -15,6 +15,18 @@ #include "ui/aura/window_tree_host.h" #include "ui/base/cursor/cursors_aura.h" +namespace { + +// Creates an empty webrtc::MouseCursor. The caller is responsible for +// destroying the returned cursor. +webrtc::MouseCursor* CreateEmptyMouseCursor() { + return new webrtc::MouseCursor( + new webrtc::BasicDesktopFrame(webrtc::DesktopSize(0, 0)), + webrtc::DesktopVector(0, 0)); +} + +} // namespace + namespace remoting { MouseCursorMonitorAura::MouseCursorMonitorAura() @@ -36,6 +48,7 @@ void MouseCursorMonitorAura::Capture() { ash::Shell::GetPrimaryRootWindow()->GetHost()->last_cursor(); if (cursor != last_cursor_) { + last_cursor_ = cursor; NotifyCursorChanged(cursor); } @@ -53,14 +66,19 @@ void MouseCursorMonitorAura::Capture() { void MouseCursorMonitorAura::NotifyCursorChanged(const ui::Cursor& cursor) { scoped_ptr<SkBitmap> cursor_bitmap(new SkBitmap()); gfx::Point cursor_hotspot; + + if (cursor.native_type() == ui::kCursorNone) { + callback_->OnMouseCursor(CreateEmptyMouseCursor()); + return; + } + if (!ui::GetCursorBitmap(cursor, cursor_bitmap.get(), &cursor_hotspot)) { LOG(ERROR) << "Failed to load bitmap for cursor type:" << cursor.native_type(); + callback_->OnMouseCursor(CreateEmptyMouseCursor()); return; } - last_cursor_ = cursor; - // There is a bug (crbug.com/436993) in aura::GetCursorBitmap() such that it // it would return a scale-factor-100 bitmap with a scale-factor-200 hotspot. // This causes the hotspot to go out of range. As a result, we would need to |