Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / remoting / host / chromeos / clipboard_aura.h
blob1d03380a3be1b542ff8e8d230624f9f964f260f3
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"
13 namespace remoting {
15 namespace protocol {
16 class ClipboardStub;
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
24 // into aura.
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 {
30 public:
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);
41 private:
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_