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

Side by Side Diff: remoting/host/chromeos/mouse_cursor_monitor_aura.cc

Issue 833693002: Hide the cursor on the client when it is hidden on the host (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "remoting/host/chromeos/mouse_cursor_monitor_aura.h" 5 #include "remoting/host/chromeos/mouse_cursor_monitor_aura.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 last_mouse_location_ = position; 46 last_mouse_location_ = position;
47 callback_->OnMouseCursorPosition( 47 callback_->OnMouseCursorPosition(
48 INSIDE, webrtc::DesktopVector(position.x(), position.y())); 48 INSIDE, webrtc::DesktopVector(position.x(), position.y()));
49 } 49 }
50 } 50 }
51 } 51 }
52 52
53 void MouseCursorMonitorAura::NotifyCursorChanged(const ui::Cursor& cursor) { 53 void MouseCursorMonitorAura::NotifyCursorChanged(const ui::Cursor& cursor) {
54 scoped_ptr<SkBitmap> cursor_bitmap(new SkBitmap()); 54 scoped_ptr<SkBitmap> cursor_bitmap(new SkBitmap());
55 gfx::Point cursor_hotspot; 55 gfx::Point cursor_hotspot;
56
57 if (cursor.native_type() == ui::kCursorNone) {
58 return;
Sergey Ulanov 2015/01/05 18:00:25 Should we notify the client that the cursor is hid
Wez 2015/01/05 20:02:46 Yes, please do. There is even an EmptyCursorShape(
kelvinp 2015/01/06 02:22:18 Whoa, excellent point. I have taken the step a lit
59 }
60
56 if (!ui::GetCursorBitmap(cursor, cursor_bitmap.get(), &cursor_hotspot)) { 61 if (!ui::GetCursorBitmap(cursor, cursor_bitmap.get(), &cursor_hotspot)) {
57 LOG(ERROR) << "Failed to load bitmap for cursor type:" 62 LOG(ERROR) << "Failed to load bitmap for cursor type:"
58 << cursor.native_type(); 63 << cursor.native_type();
59 return; 64 return;
60 } 65 }
61 66
62 last_cursor_ = cursor; 67 last_cursor_ = cursor;
63 68
64 // There is a bug (crbug.com/436993) in aura::GetCursorBitmap() such that it 69 // There is a bug (crbug.com/436993) in aura::GetCursorBitmap() such that it
65 // it would return a scale-factor-100 bitmap with a scale-factor-200 hotspot. 70 // it would return a scale-factor-100 bitmap with a scale-factor-200 hotspot.
(...skipping 13 matching lines...) Expand all
79 scoped_ptr<webrtc::DesktopFrame> image( 84 scoped_ptr<webrtc::DesktopFrame> image(
80 SkiaBitmapDesktopFrame::Create(cursor_bitmap.Pass())); 85 SkiaBitmapDesktopFrame::Create(cursor_bitmap.Pass()));
81 scoped_ptr<webrtc::MouseCursor> cursor_shape(new webrtc::MouseCursor( 86 scoped_ptr<webrtc::MouseCursor> cursor_shape(new webrtc::MouseCursor(
82 image.release(), 87 image.release(),
83 webrtc::DesktopVector(cursor_hotspot.x(), cursor_hotspot.y()))); 88 webrtc::DesktopVector(cursor_hotspot.x(), cursor_hotspot.y())));
84 89
85 callback_->OnMouseCursor(cursor_shape.release()); 90 callback_->OnMouseCursor(cursor_shape.release());
86 } 91 }
87 92
88 } // namespace remoting 93 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698