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