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