| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/gfx/size.h" | 9 #include "ui/gfx/size.h" |
| 10 | 10 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 if (!bitmap_data->Map(bitmap_bytes)) { | 68 if (!bitmap_data->Map(bitmap_bytes)) { |
| 69 PLOG(ERROR) << "Failed to map bitmap memory"; | 69 PLOG(ERROR) << "Failed to map bitmap memory"; |
| 70 return false; | 70 return false; |
| 71 } | 71 } |
| 72 return true; | 72 return true; |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace | 75 } // namespace |
| 76 | 76 |
| 77 const char Clipboard::kMimeTypeText[] = "text/plain"; | 77 const char Clipboard::kMimeTypeText[] = "text/plain"; |
| 78 const char Clipboard::kMimeTypeURIList[] = "text/uri-list"; |
| 79 const char Clipboard::kMimeTypeDownloadURL[] = "downloadurl"; |
| 78 const char Clipboard::kMimeTypeHTML[] = "text/html"; | 80 const char Clipboard::kMimeTypeHTML[] = "text/html"; |
| 79 const char Clipboard::kMimeTypePNG[] = "image/png"; | 81 const char Clipboard::kMimeTypePNG[] = "image/png"; |
| 80 | 82 |
| 81 void Clipboard::DispatchObject(ObjectType type, const ObjectMapParams& params) { | 83 void Clipboard::DispatchObject(ObjectType type, const ObjectMapParams& params) { |
| 82 // All types apart from CBF_WEBKIT need at least 1 non-empty param. | 84 // All types apart from CBF_WEBKIT need at least 1 non-empty param. |
| 83 if (type != CBF_WEBKIT && (params.empty() || params[0].empty())) | 85 if (type != CBF_WEBKIT && (params.empty() || params[0].empty())) |
| 84 return; | 86 return; |
| 85 // Some other types need a non-empty 2nd param. | 87 // Some other types need a non-empty 2nd param. |
| 86 if ((type == CBF_BOOKMARK || type == CBF_BITMAP || | 88 if ((type == CBF_BOOKMARK || type == CBF_BITMAP || |
| 87 type == CBF_SMBITMAP || type == CBF_DATA) && | 89 type == CBF_SMBITMAP || type == CBF_DATA) && |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // UI thread (see DispatchObject()). | 181 // UI thread (see DispatchObject()). |
| 180 iter->second[0].clear(); | 182 iter->second[0].clear(); |
| 181 for (size_t i = 0; i < sizeof(SharedMemory*); ++i) | 183 for (size_t i = 0; i < sizeof(SharedMemory*); ++i) |
| 182 iter->second[0].push_back(reinterpret_cast<char*>(&bitmap)[i]); | 184 iter->second[0].push_back(reinterpret_cast<char*>(&bitmap)[i]); |
| 183 has_shared_bitmap = true; | 185 has_shared_bitmap = true; |
| 184 } | 186 } |
| 185 } | 187 } |
| 186 } | 188 } |
| 187 | 189 |
| 188 } // namespace ui | 190 } // namespace ui |
| OLD | NEW |