Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(573)

Unified Diff: components/mus/clipboard/clipboard_impl.h

Issue 1978763003: Readd the clipboard service and get it compiling again. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sequence numbers in state. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/mus/clipboard/BUILD.gn ('k') | components/mus/clipboard/clipboard_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/clipboard/clipboard_impl.h
diff --git a/components/mus/clipboard/clipboard_impl.h b/components/mus/clipboard/clipboard_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..f77977cad4a74efc51a97ab820e76d70b4552342
--- /dev/null
+++ b/components/mus/clipboard/clipboard_impl.h
@@ -0,0 +1,67 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_MUS_CLIPBOARD_CLIPBOARD_IMPL_H_
+#define COMPONENTS_MUS_CLIPBOARD_CLIPBOARD_IMPL_H_
+
+#include <stdint.h>
+
+#include <string>
+
+#include "base/macros.h"
+#include "components/mus/public/interfaces/clipboard.mojom.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+
+namespace mus {
+namespace clipboard {
+
+// Stub clipboard implementation.
+//
+// Eventually, we'll actually want to interact with the system clipboard, but
+// that's hard today because the system clipboard is asynchronous (on X11), the
+// ui::Clipboard interface is synchronous (which is what we'd use), mojo is
+// asynchronous across processes, and the WebClipboard interface is synchronous
+// (which is at least tractable).
+class ClipboardImpl : public mojom::Clipboard {
+ public:
+ // mojom::Clipboard exposes three possible clipboards.
+ static const int kNumClipboards = 3;
+
+ ClipboardImpl();
+ ~ClipboardImpl() override;
+
+ void AddBinding(mojom::ClipboardRequest request);
+
+ // mojom::Clipboard implementation.
+ void GetSequenceNumber(
+ mojom::Clipboard::Type clipboard_type,
+ const GetSequenceNumberCallback& callback) override;
+ void GetAvailableMimeTypes(
+ mojom::Clipboard::Type clipboard_types,
+ const GetAvailableMimeTypesCallback& callback) override;
+ void ReadMimeType(
+ uint64_t sequence,
+ mojom::Clipboard::Type clipboard_type,
+ const mojo::String& mime_type,
+ const ReadMimeTypeCallback& callback) override;
+ void WriteClipboardData(
+ mojom::Clipboard::Type clipboard_type,
+ mojo::Map<mojo::String, mojo::Array<uint8_t>> data,
+ const WriteClipboardDataCallback& callback) override;
+
+ private:
+ // Internal struct which stores the current state of the clipboard.
+ class ClipboardData;
+
+ // The current clipboard state. This is what is read from.
+ std::unique_ptr<ClipboardData> clipboard_state_[kNumClipboards];
+ mojo::BindingSet<mojom::Clipboard> bindings_;
+
+ DISALLOW_COPY_AND_ASSIGN(ClipboardImpl);
+};
+
+} // namespace clipboard
+} // namespace mus
+
+#endif // COMPONENTS_MUS_CLIPBOARD_CLIPBOARD_IMPL_H_
« no previous file with comments | « components/mus/clipboard/BUILD.gn ('k') | components/mus/clipboard/clipboard_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698