| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 SERVICES_UI_CLIPBOARD_CLIPBOARD_IMPL_H_ | 5 #ifndef SERVICES_UI_CLIPBOARD_CLIPBOARD_IMPL_H_ |
| 6 #define SERVICES_UI_CLIPBOARD_CLIPBOARD_IMPL_H_ | 6 #define SERVICES_UI_CLIPBOARD_CLIPBOARD_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "mojo/public/cpp/bindings/binding_set.h" | 13 #include "mojo/public/cpp/bindings/binding_set.h" |
| 14 #include "services/ui/public/interfaces/clipboard.mojom.h" | 14 #include "services/ui/public/interfaces/clipboard.mojom.h" |
| 15 | 15 |
| 16 namespace ui { | 16 namespace ui { |
| 17 namespace clipboard { | 17 namespace clipboard { |
| 18 | 18 |
| 19 // Stub clipboard implementation. | 19 // Stub clipboard implementation. |
| 20 // | 20 // |
| 21 // Eventually, we'll actually want to interact with the system clipboard, but | 21 // Eventually, we'll actually want to interact with the system clipboard, but |
| 22 // that's hard today because the system clipboard is asynchronous (on X11), the | 22 // that's hard today because the system clipboard is asynchronous (on X11), the |
| 23 // ui::Clipboard interface is synchronous (which is what we'd use), mojo is | 23 // ui::Clipboard interface is synchronous (which is what we'd use), mojo is |
| 24 // asynchronous across processes, and the WebClipboard interface is synchronous | 24 // asynchronous across processes, and the WebClipboard interface is synchronous |
| 25 // (which is at least tractable). | 25 // (which is at least tractable). |
| 26 class ClipboardImpl : public mojom::Clipboard { | 26 class ClipboardImpl : public mojom::Clipboard { |
| 27 public: | 27 public: |
| 28 // mojom::Clipboard exposes three possible clipboards. | 28 // mojom::Clipboard exposes three possible clipboards. |
| 29 static const int kNumClipboards = 3; | 29 static const int kNumClipboards = 2; |
| 30 | 30 |
| 31 ClipboardImpl(); | 31 ClipboardImpl(); |
| 32 ~ClipboardImpl() override; | 32 ~ClipboardImpl() override; |
| 33 | 33 |
| 34 void AddBinding(mojom::ClipboardRequest request); | 34 void AddBinding(mojom::ClipboardRequest request); |
| 35 | 35 |
| 36 // mojom::Clipboard implementation. | 36 // mojom::Clipboard implementation. |
| 37 void GetSequenceNumber( | 37 void GetSequenceNumber( |
| 38 mojom::Clipboard::Type clipboard_type, | 38 mojom::Clipboard::Type clipboard_type, |
| 39 const GetSequenceNumberCallback& callback) override; | 39 const GetSequenceNumberCallback& callback) override; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 56 std::unique_ptr<ClipboardData> clipboard_state_[kNumClipboards]; | 56 std::unique_ptr<ClipboardData> clipboard_state_[kNumClipboards]; |
| 57 mojo::BindingSet<mojom::Clipboard> bindings_; | 57 mojo::BindingSet<mojom::Clipboard> bindings_; |
| 58 | 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(ClipboardImpl); | 59 DISALLOW_COPY_AND_ASSIGN(ClipboardImpl); |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } // namespace clipboard | 62 } // namespace clipboard |
| 63 } // namespace ui | 63 } // namespace ui |
| 64 | 64 |
| 65 #endif // SERVICES_UI_CLIPBOARD_CLIPBOARD_IMPL_H_ | 65 #endif // SERVICES_UI_CLIPBOARD_CLIPBOARD_IMPL_H_ |
| OLD | NEW |