Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / remoting / host / fake_mouse_cursor_monitor.cc
blob10facb5a7b78b321fa9c80386c2ff1b96bf5153b
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
3 // found in the LICENSE file.
5 #include "remoting/host/fake_mouse_cursor_monitor.h"
7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
10 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
11 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor.h"
13 namespace remoting {
15 FakeMouseCursorMonitor::FakeMouseCursorMonitor() : callback_(nullptr) {}
17 FakeMouseCursorMonitor::~FakeMouseCursorMonitor() {}
19 void FakeMouseCursorMonitor::Init(
20 webrtc::MouseCursorMonitor::Callback* callback,
21 webrtc::MouseCursorMonitor::Mode mode) {
22 DCHECK(!callback_);
23 DCHECK(callback);
25 // Only shapes supported right now.
26 CHECK(mode == SHAPE_ONLY);
28 callback_ = callback;
31 void FakeMouseCursorMonitor::Capture() {
32 DCHECK(callback_);
34 const int kWidth = 32;
35 const int kHeight = 32;
37 scoped_ptr<webrtc::DesktopFrame> desktop_frame(
38 new webrtc::BasicDesktopFrame(webrtc::DesktopSize(kWidth, kHeight)));
39 memset(desktop_frame->data(), 0xFF,
40 webrtc::DesktopFrame::kBytesPerPixel * kWidth * kHeight);
42 scoped_ptr<webrtc::MouseCursor> mouse_cursor(
43 new webrtc::MouseCursor(desktop_frame.release(),
44 webrtc::DesktopVector()));
46 callback_->OnMouseCursor(mouse_cursor.release());
49 } // namespace remoting