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

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

Issue 779063003: Move //services/clipboard code out of namespace mojo (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
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 SERVICES_CLIPBOARD_CLIPBOARD_STANDALONE_IMPL_H_ 5 #ifndef SERVICES_CLIPBOARD_CLIPBOARD_STANDALONE_IMPL_H_
6 #define SERVICES_CLIPBOARD_CLIPBOARD_STANDALONE_IMPL_H_ 6 #define SERVICES_CLIPBOARD_CLIPBOARD_STANDALONE_IMPL_H_
7 7
8 #include <base/memory/scoped_ptr.h> 8 #include <base/memory/scoped_ptr.h>
9 #include <string> 9 #include <string>
10 10
11 #include "mojo/services/public/interfaces/clipboard/clipboard.mojom.h" 11 #include "mojo/services/public/interfaces/clipboard/clipboard.mojom.h"
12 12
13 namespace mojo { 13 namespace services {
14 14
15 // Stub clipboard implementation. 15 // Stub clipboard implementation.
16 // 16 //
17 // Eventually, we'll actually want to interact with the system clipboard, but 17 // Eventually, we'll actually want to interact with the system clipboard, but
18 // that's hard today because the system clipboard is asynchronous (on X11), the 18 // that's hard today because the system clipboard is asynchronous (on X11), the
19 // ui::Clipboard interface is synchronous (which is what we'd use), mojo is 19 // ui::Clipboard interface is synchronous (which is what we'd use), mojo is
20 // asynchronous across processes, and the WebClipboard interface is synchronous 20 // asynchronous across processes, and the WebClipboard interface is synchronous
21 // (which is at least tractable). 21 // (which is at least tractable).
22 class ClipboardStandaloneImpl : public InterfaceImpl<mojo::Clipboard> { 22 class ClipboardStandaloneImpl : public mojo::InterfaceImpl<mojo::Clipboard> {
23 public: 23 public:
24 // mojo::Clipboard exposes three possible clipboards. 24 // mojo::Clipboard exposes three possible clipboards.
25 static const int kNumClipboards = 3; 25 static const int kNumClipboards = 3;
26 26
27 ClipboardStandaloneImpl(); 27 ClipboardStandaloneImpl();
28 ~ClipboardStandaloneImpl() override; 28 ~ClipboardStandaloneImpl() override;
29 29
30 // InterfaceImpl<mojo::Clipboard> implementation. 30 // InterfaceImpl<mojo::Clipboard> implementation.
31 void GetSequenceNumber( 31 void GetSequenceNumber(
32 Clipboard::Type clipboard_type, 32 mojo::Clipboard::Type clipboard_type,
33 const mojo::Callback<void(uint64_t)>& callback) override; 33 const mojo::Callback<void(uint64_t)>& callback) override;
34 void GetAvailableMimeTypes( 34 void GetAvailableMimeTypes(
35 Clipboard::Type clipboard_types, 35 mojo::Clipboard::Type clipboard_types,
36 const mojo::Callback<void(mojo::Array<mojo::String>)>& callback) override; 36 const mojo::Callback<void(mojo::Array<mojo::String>)>& callback) override;
37 void ReadMimeType( 37 void ReadMimeType(
38 Clipboard::Type clipboard_type, 38 mojo::Clipboard::Type clipboard_type,
39 const mojo::String& mime_type, 39 const mojo::String& mime_type,
40 const mojo::Callback<void(mojo::Array<uint8_t>)>& callback) override; 40 const mojo::Callback<void(mojo::Array<uint8_t>)>& callback) override;
41 void WriteClipboardData( 41 void WriteClipboardData(
42 Clipboard::Type clipboard_type, 42 mojo::Clipboard::Type clipboard_type,
43 mojo::Map<mojo::String, mojo::Array<uint8_t>> data) override; 43 mojo::Map<mojo::String, mojo::Array<uint8_t>> data) override;
44 44
45 private: 45 private:
46 uint64_t sequence_number_[kNumClipboards]; 46 uint64_t sequence_number_[kNumClipboards];
47 47
48 // Internal struct which stores the current state of the clipboard. 48 // Internal struct which stores the current state of the clipboard.
49 class ClipboardData; 49 class ClipboardData;
50 50
51 // The current clipboard state. This is what is read from. 51 // The current clipboard state. This is what is read from.
52 scoped_ptr<ClipboardData> clipboard_state_[kNumClipboards]; 52 scoped_ptr<ClipboardData> clipboard_state_[kNumClipboards];
53 53
54 DISALLOW_COPY_AND_ASSIGN(ClipboardStandaloneImpl); 54 DISALLOW_COPY_AND_ASSIGN(ClipboardStandaloneImpl);
55 }; 55 };
56 56
57 } // namespace mojo 57 } // namespace services
58 58
59 #endif // SERVICES_CLIPBOARD_CLIPBOARD_STANDALONE_IMPL_H_ 59 #endif // SERVICES_CLIPBOARD_CLIPBOARD_STANDALONE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698