| 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_aura.h" | 5 #include "ui/base/clipboard/clipboard_aura.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <list> | 10 #include <list> |
| 11 #include <memory> | 11 #include <memory> |
| 12 | 12 |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "third_party/skia/include/core/SkBitmap.h" | 18 #include "third_party/skia/include/core/SkBitmap.h" |
| 19 #include "ui/base/clipboard/custom_data_helper.h" | 19 #include "ui/base/clipboard/custom_data_helper.h" |
| 20 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
| 21 | 21 |
| 22 namespace ui { | 22 namespace ui { |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 const char kMimeTypeFilename[] = "chromium/filename"; | 25 const char kMimeTypeFilename[] = "chromium/filename"; |
| 26 const char kMimeTypeBitmap[] = "image/bmp"; | 26 const char kMimeTypeBitmap[] = "image/bmp"; |
| 27 const char kMimeTypePepperCustomData[] = "chromium/x-pepper-custom-data"; | |
| 28 const char kMimeTypeWebkitSmartPaste[] = "chromium/x-webkit-paste"; | |
| 29 const size_t kMaxClipboardSize = 1; | 27 const size_t kMaxClipboardSize = 1; |
| 30 | 28 |
| 31 // Clipboard data format used by AuraClipboard. | 29 // Clipboard data format used by AuraClipboard. |
| 32 enum AuraClipboardFormat { | 30 enum AuraClipboardFormat { |
| 33 TEXT = 1 << 0, | 31 TEXT = 1 << 0, |
| 34 HTML = 1 << 1, | 32 HTML = 1 << 1, |
| 35 RTF = 1 << 2, | 33 RTF = 1 << 2, |
| 36 BOOKMARK = 1 << 3, | 34 BOOKMARK = 1 << 3, |
| 37 BITMAP = 1 << 4, | 35 BITMAP = 1 << 4, |
| 38 CUSTOM = 1 << 5, | 36 CUSTOM = 1 << 5, |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeURIList)); | 448 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeURIList)); |
| 451 return type; | 449 return type; |
| 452 } | 450 } |
| 453 | 451 |
| 454 // static | 452 // static |
| 455 const Clipboard::FormatType& Clipboard::GetUrlWFormatType() { | 453 const Clipboard::FormatType& Clipboard::GetUrlWFormatType() { |
| 456 return GetUrlFormatType(); | 454 return GetUrlFormatType(); |
| 457 } | 455 } |
| 458 | 456 |
| 459 // static | 457 // static |
| 458 const Clipboard::FormatType& Clipboard::GetMozUrlFormatType() { |
| 459 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeMozillaURL)); |
| 460 return type; |
| 461 } |
| 462 |
| 463 // static |
| 460 const Clipboard::FormatType& Clipboard::GetPlainTextFormatType() { | 464 const Clipboard::FormatType& Clipboard::GetPlainTextFormatType() { |
| 461 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeText)); | 465 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeText)); |
| 462 return type; | 466 return type; |
| 463 } | 467 } |
| 464 | 468 |
| 465 // static | 469 // static |
| 466 const Clipboard::FormatType& Clipboard::GetPlainTextWFormatType() { | 470 const Clipboard::FormatType& Clipboard::GetPlainTextWFormatType() { |
| 467 return GetPlainTextFormatType(); | 471 return GetPlainTextFormatType(); |
| 468 } | 472 } |
| 469 | 473 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 ClipboardDataBuilder::WriteBitmap(bitmap); | 687 ClipboardDataBuilder::WriteBitmap(bitmap); |
| 684 } | 688 } |
| 685 | 689 |
| 686 void ClipboardAura::WriteData(const FormatType& format, | 690 void ClipboardAura::WriteData(const FormatType& format, |
| 687 const char* data_data, | 691 const char* data_data, |
| 688 size_t data_len) { | 692 size_t data_len) { |
| 689 ClipboardDataBuilder::WriteData(format.ToString(), data_data, data_len); | 693 ClipboardDataBuilder::WriteData(format.ToString(), data_data, data_len); |
| 690 } | 694 } |
| 691 | 695 |
| 692 } // namespace ui | 696 } // namespace ui |
| OLD | NEW |