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

Side by Side Diff: mojo/services/clipboard/clipboard_standalone_impl.h

Issue 1049993002: Get mojo_shell building inside chromium checkout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix presubmit Created 5 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef SERVICES_CLIPBOARD_CLIPBOARD_STANDALONE_IMPL_H_
6 #define SERVICES_CLIPBOARD_CLIPBOARD_STANDALONE_IMPL_H_
7
8 #include <base/memory/scoped_ptr.h>
9 #include <string>
10
11 #include "mojo/public/cpp/bindings/strong_binding.h"
12 #include "third_party/mojo_services/src/clipboard/public/interfaces/clipboard.mo jom.h"
13
14 namespace clipboard {
15
16 // Stub clipboard implementation.
17 //
18 // Eventually, we'll actually want to interact with the system clipboard, but
19 // that's hard today because the system clipboard is asynchronous (on X11), the
20 // ui::Clipboard interface is synchronous (which is what we'd use), mojo is
21 // asynchronous across processes, and the WebClipboard interface is synchronous
22 // (which is at least tractable).
23 class ClipboardStandaloneImpl : public mojo::Clipboard {
24 public:
25 // mojo::Clipboard exposes three possible clipboards.
26 static const int kNumClipboards = 3;
27
28 explicit ClipboardStandaloneImpl(
29 mojo::InterfaceRequest<mojo::Clipboard> request);
30 ~ClipboardStandaloneImpl() override;
31
32 // mojo::Clipboard implementation.
33 void GetSequenceNumber(
34 mojo::Clipboard::Type clipboard_type,
35 const mojo::Callback<void(uint64_t)>& callback) override;
36 void GetAvailableMimeTypes(
37 mojo::Clipboard::Type clipboard_types,
38 const mojo::Callback<void(mojo::Array<mojo::String>)>& callback) override;
39 void ReadMimeType(
40 mojo::Clipboard::Type clipboard_type,
41 const mojo::String& mime_type,
42 const mojo::Callback<void(mojo::Array<uint8_t>)>& callback) override;
43 void WriteClipboardData(
44 mojo::Clipboard::Type clipboard_type,
45 mojo::Map<mojo::String, mojo::Array<uint8_t>> data) override;
46
47 private:
48 uint64_t sequence_number_[kNumClipboards];
49
50 // Internal struct which stores the current state of the clipboard.
51 class ClipboardData;
52
53 // The current clipboard state. This is what is read from.
54 scoped_ptr<ClipboardData> clipboard_state_[kNumClipboards];
55 mojo::StrongBinding<mojo::Clipboard> binding_;
56
57 DISALLOW_COPY_AND_ASSIGN(ClipboardStandaloneImpl);
58 };
59
60 } // namespace clipboard
61
62 #endif // SERVICES_CLIPBOARD_CLIPBOARD_STANDALONE_IMPL_H_
OLDNEW
« no previous file with comments | « mojo/services/clipboard/clipboard_apptest.cc ('k') | mojo/services/clipboard/clipboard_standalone_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698