| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/base/clipboard/clipboard.h" | 5 #include "ui/base/clipboard/clipboard.h" |
| 6 | 6 |
| 7 #include <iterator> | 7 #include <iterator> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 // The union serves to easily convert SourceTag into its binary representation | 97 // The union serves to easily convert SourceTag into its binary representation |
| 98 // and vice versa. | 98 // and vice versa. |
| 99 union SourceTag2BinaryHelper { | 99 union SourceTag2BinaryHelper { |
| 100 SourceTag tag; | 100 SourceTag tag; |
| 101 uint8 bytes[kSourceTagSize]; | 101 uint8 bytes[kSourceTagSize]; |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 } // namespace | 104 } // namespace |
| 105 | 105 |
| 106 const char Clipboard::kMimeTypeText[] = "text/plain"; | |
| 107 const char Clipboard::kMimeTypeURIList[] = "text/uri-list"; | |
| 108 const char Clipboard::kMimeTypeDownloadURL[] = "downloadurl"; | |
| 109 const char Clipboard::kMimeTypeHTML[] = "text/html"; | |
| 110 const char Clipboard::kMimeTypeRTF[] = "text/rtf"; | |
| 111 const char Clipboard::kMimeTypePNG[] = "image/png"; | |
| 112 | |
| 113 // static | 106 // static |
| 114 Clipboard::ObjectMapParam Clipboard::SourceTag2Binary(SourceTag tag) { | 107 Clipboard::ObjectMapParam Clipboard::SourceTag2Binary(SourceTag tag) { |
| 115 SourceTag2BinaryHelper helper; | 108 SourceTag2BinaryHelper helper; |
| 116 helper.tag = tag; | 109 helper.tag = tag; |
| 117 std::vector<char> bytes(kSourceTagSize); | 110 std::vector<char> bytes(kSourceTagSize); |
| 118 memcpy(&bytes[0], helper.bytes, kSourceTagSize); | 111 memcpy(&bytes[0], helper.bytes, kSourceTagSize); |
| 119 return bytes; | 112 return bytes; |
| 120 } | 113 } |
| 121 | 114 |
| 122 // static | 115 // static |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 // UI thread (see DispatchObject()). | 286 // UI thread (see DispatchObject()). |
| 294 iter->second[0].clear(); | 287 iter->second[0].clear(); |
| 295 for (size_t i = 0; i < sizeof(SharedMemory*); ++i) | 288 for (size_t i = 0; i < sizeof(SharedMemory*); ++i) |
| 296 iter->second[0].push_back(reinterpret_cast<char*>(&bitmap)[i]); | 289 iter->second[0].push_back(reinterpret_cast<char*>(&bitmap)[i]); |
| 297 has_shared_bitmap = true; | 290 has_shared_bitmap = true; |
| 298 } | 291 } |
| 299 } | 292 } |
| 300 } | 293 } |
| 301 | 294 |
| 302 } // namespace ui | 295 } // namespace ui |
| OLD | NEW |