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

Side by Side Diff: ui/views/mus/clipboard_mus.h

Issue 2504403004: Mojo C++ bindings: switch the generated code of clipboard.mojom to use STL types. (Closed)
Patch Set: . Created 4 years, 1 month 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 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 UI_VIEWS_MUS_CLIPBOARD_MUS_H_ 5 #ifndef UI_VIEWS_MUS_CLIPBOARD_MUS_H_
6 #define UI_VIEWS_MUS_CLIPBOARD_MUS_H_ 6 #define UI_VIEWS_MUS_CLIPBOARD_MUS_H_
7 7
8 #include "services/ui/public/interfaces/clipboard.mojom.h" 8 #include "services/ui/public/interfaces/clipboard.mojom.h"
9 #include "ui/base/clipboard/clipboard.h" 9 #include "ui/base/clipboard/clipboard.h"
10 #include "ui/views/mus/mus_export.h" 10 #include "ui/views/mus/mus_export.h"
11 11
12 namespace service_manager { 12 namespace service_manager {
13 class Connector; 13 class Connector;
14 } 14 }
15 15
16 namespace views { 16 namespace views {
17 17
18 // An adaptor class which translates the ui::Clipboard interface to the 18 // An adaptor class which translates the ui::Clipboard interface to the
19 // clipboard provided by mus. 19 // clipboard provided by mus.
20 class VIEWS_MUS_EXPORT ClipboardMus : public ui::Clipboard { 20 class VIEWS_MUS_EXPORT ClipboardMus : public ui::Clipboard {
21 public: 21 public:
22 ClipboardMus(); 22 ClipboardMus();
23 ~ClipboardMus() override; 23 ~ClipboardMus() override;
24 24
25 void Init(service_manager::Connector* connector); 25 void Init(service_manager::Connector* connector);
26 26
27 private: 27 private:
28 bool HasMimeType(const mojo::Array<mojo::String>& available_types, 28 bool HasMimeType(const std::vector<std::string>& available_types,
29 const std::string& type) const; 29 const std::string& type) const;
30 30
31 // Clipboard overrides: 31 // Clipboard overrides:
32 uint64_t GetSequenceNumber(ui::ClipboardType type) const override; 32 uint64_t GetSequenceNumber(ui::ClipboardType type) const override;
33 bool IsFormatAvailable(const FormatType& format, 33 bool IsFormatAvailable(const FormatType& format,
34 ui::ClipboardType type) const override; 34 ui::ClipboardType type) const override;
35 void Clear(ui::ClipboardType type) override; 35 void Clear(ui::ClipboardType type) override;
36 void ReadAvailableTypes(ui::ClipboardType type, 36 void ReadAvailableTypes(ui::ClipboardType type,
37 std::vector<base::string16>* types, 37 std::vector<base::string16>* types,
38 bool* contains_filenames) const override; 38 bool* contains_filenames) const override;
(...skipping 22 matching lines...) Expand all
61 void WriteBookmark(const char* title_data, 61 void WriteBookmark(const char* title_data,
62 size_t title_len, 62 size_t title_len,
63 const char* url_data, 63 const char* url_data,
64 size_t url_len) override; 64 size_t url_len) override;
65 void WriteWebSmartPaste() override; 65 void WriteWebSmartPaste() override;
66 void WriteBitmap(const SkBitmap& bitmap) override; 66 void WriteBitmap(const SkBitmap& bitmap) override;
67 void WriteData(const FormatType& format, 67 void WriteData(const FormatType& format,
68 const char* data_data, 68 const char* data_data,
69 size_t data_len) override; 69 size_t data_len) override;
70 70
71 static mojo::String GetMimeTypeFor(const FormatType& format); 71 static std::string GetMimeTypeFor(const FormatType& format);
72 72
73 ui::mojom::ClipboardPtr clipboard_; 73 ui::mojom::ClipboardPtr clipboard_;
74 74
75 // Internal buffer used to accumulate data types. The public interface is 75 // Internal buffer used to accumulate data types. The public interface is
76 // WriteObjects(), which then calls our base class DispatchObject() which 76 // WriteObjects(), which then calls our base class DispatchObject() which
77 // then calls into each data type specific Write() function. Once we've 77 // then calls into each data type specific Write() function. Once we've
78 // collected all the data types, we then pass this to the mus server. 78 // collected all the data types, we then pass this to the mus server.
79 std::unique_ptr<mojo::Map<mojo::String, mojo::Array<uint8_t>>> 79 base::Optional<std::unordered_map<std::string, std::vector<uint8_t>>>
80 current_clipboard_; 80 current_clipboard_;
81 81
82 DISALLOW_COPY_AND_ASSIGN(ClipboardMus); 82 DISALLOW_COPY_AND_ASSIGN(ClipboardMus);
83 }; 83 };
84 84
85 } // namespace views 85 } // namespace views
86 86
87 #endif // UI_VIEWS_MUS_CLIPBOARD_MUS_H_ 87 #endif // UI_VIEWS_MUS_CLIPBOARD_MUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698