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 #include "services/ui/clipboard/clipboard_impl.h" | 5 #include "services/ui/clipboard/clipboard_impl.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "mojo/common/common_type_converters.h" | 11 #include "mojo/common/common_type_converters.h" |
12 #include "mojo/public/cpp/bindings/array.h" | 12 #include "mojo/public/cpp/bindings/array.h" |
13 #include "mojo/public/cpp/bindings/string.h" | |
14 | 13 |
15 namespace ui { | 14 namespace ui { |
16 namespace clipboard { | 15 namespace clipboard { |
17 | 16 |
18 using DataMap = std::unordered_map<std::string, std::vector<uint8_t>>; | 17 using DataMap = std::unordered_map<std::string, std::vector<uint8_t>>; |
19 | 18 |
20 // ClipboardData contains data copied to the Clipboard for a variety of formats. | 19 // ClipboardData contains data copied to the Clipboard for a variety of formats. |
21 // It mostly just provides APIs to cleanly access and manipulate this data. | 20 // It mostly just provides APIs to cleanly access and manipulate this data. |
22 class ClipboardImpl::ClipboardData { | 21 class ClipboardImpl::ClipboardData { |
23 public: | 22 public: |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 Clipboard::Type clipboard_type, | 97 Clipboard::Type clipboard_type, |
99 const base::Optional<DataMap>& data, | 98 const base::Optional<DataMap>& data, |
100 const WriteClipboardDataCallback& callback) { | 99 const WriteClipboardDataCallback& callback) { |
101 int clipboard_num = static_cast<int>(clipboard_type); | 100 int clipboard_num = static_cast<int>(clipboard_type); |
102 clipboard_state_[clipboard_num]->SetData(data); | 101 clipboard_state_[clipboard_num]->SetData(data); |
103 callback.Run(clipboard_state_[clipboard_num]->sequence_number()); | 102 callback.Run(clipboard_state_[clipboard_num]->sequence_number()); |
104 } | 103 } |
105 | 104 |
106 } // namespace clipboard | 105 } // namespace clipboard |
107 } // namespace ui | 106 } // namespace ui |
OLD | NEW |