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 #ifndef REMOTING_HOST_CLIPBOARD_AURA_H_
6 #define REMOTING_HOST_CLIPBOARD_AURA_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/threading/thread_checker.h"
10 #include "base/timer/timer.h"
11 #include "remoting/host/clipboard.h"
17 } // namespace protocol
19 // On Chrome OS, the clipboard is managed by aura instead of the underlying
20 // native platform (e.g. x11, ozone, etc).
22 // This class (1) monitors the aura clipboard for changes and notifies the
23 // |client_clipboard|, and (2) provides an interface to inject clipboard event
26 // The public API of this class can be called in any thread as internally it
27 // always posts the call to the |ui_task_runner|. On ChromeOS, that should
28 // be the UI thread of the browser process.
29 class ClipboardAura
: public Clipboard
{
31 explicit ClipboardAura();
32 ~ClipboardAura() override
;
34 // Clipboard interface.
35 void Start(scoped_ptr
<protocol::ClipboardStub
> client_clipboard
) override
;
36 void InjectClipboardEvent(const protocol::ClipboardEvent
& event
) override
;
38 // Overrides the clipboard polling interval for unit test.
39 void SetPollingIntervalForTesting(base::TimeDelta polling_interval
);
42 void CheckClipboardForChanges();
44 base::ThreadChecker thread_checker_
;
45 scoped_ptr
<protocol::ClipboardStub
> client_clipboard_
;
46 base::RepeatingTimer
<ClipboardAura
> clipboard_polling_timer_
;
47 uint64 current_change_count_
;
48 base::TimeDelta polling_interval_
;
50 DISALLOW_COPY_AND_ASSIGN(ClipboardAura
);
53 } // namespace remoting
55 #endif // REMOTING_HOST_CLIPBOARD_AURA_H_