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 <list> | 7 #include <list> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 DispatchObject(static_cast<ObjectType>(iter->first), iter->second); | 455 DispatchObject(static_cast<ObjectType>(iter->first), iter->second); |
456 } | 456 } |
457 ClipboardDataBuilder::CommitToClipboard(); | 457 ClipboardDataBuilder::CommitToClipboard(); |
458 } | 458 } |
459 | 459 |
460 bool Clipboard::IsFormatAvailable(const FormatType& format, | 460 bool Clipboard::IsFormatAvailable(const FormatType& format, |
461 Buffer buffer) const { | 461 Buffer buffer) const { |
462 DCHECK(CalledOnValidThread()); | 462 DCHECK(CalledOnValidThread()); |
463 DCHECK(IsValidBuffer(buffer)); | 463 DCHECK(IsValidBuffer(buffer)); |
464 AuraClipboard* clipboard = GetClipboard(); | 464 AuraClipboard* clipboard = GetClipboard(); |
465 if (GetPlainTextFormatType().Equals(format)) | 465 if (GetPlainTextFormatType().Equals(format) || |
| 466 GetUrlFormatType().Equals(format)) |
466 return clipboard->IsFormatAvailable(TEXT); | 467 return clipboard->IsFormatAvailable(TEXT); |
467 else if (GetHtmlFormatType().Equals(format)) | 468 else if (GetHtmlFormatType().Equals(format)) |
468 return clipboard->IsFormatAvailable(HTML); | 469 return clipboard->IsFormatAvailable(HTML); |
469 else if (GetRtfFormatType().Equals(format)) | 470 else if (GetRtfFormatType().Equals(format)) |
470 return clipboard->IsFormatAvailable(RTF); | 471 return clipboard->IsFormatAvailable(RTF); |
471 else if (GetBitmapFormatType().Equals(format)) | 472 else if (GetBitmapFormatType().Equals(format)) |
472 return clipboard->IsFormatAvailable(BITMAP); | 473 return clipboard->IsFormatAvailable(BITMAP); |
473 else if (GetWebKitSmartPasteFormatType().Equals(format)) | 474 else if (GetWebKitSmartPasteFormatType().Equals(format)) |
474 return clipboard->IsFormatAvailable(WEB); | 475 return clipboard->IsFormatAvailable(WEB); |
475 else { | 476 else { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 ClipboardDataBuilder::WriteData(format.ToString(), data_data, data_len); | 601 ClipboardDataBuilder::WriteData(format.ToString(), data_data, data_len); |
601 } | 602 } |
602 | 603 |
603 // static | 604 // static |
604 Clipboard::FormatType Clipboard::GetFormatType( | 605 Clipboard::FormatType Clipboard::GetFormatType( |
605 const std::string& format_string) { | 606 const std::string& format_string) { |
606 return FormatType::Deserialize(format_string); | 607 return FormatType::Deserialize(format_string); |
607 } | 608 } |
608 | 609 |
609 // static | 610 // static |
| 611 const Clipboard::FormatType& Clipboard::GetUrlFormatType() { |
| 612 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeURIList)); |
| 613 return type; |
| 614 } |
| 615 |
| 616 // static |
| 617 const Clipboard::FormatType& Clipboard::GetUrlWFormatType() { |
| 618 return GetUrlFormatType(); |
| 619 } |
| 620 |
| 621 // static |
610 const Clipboard::FormatType& Clipboard::GetPlainTextFormatType() { | 622 const Clipboard::FormatType& Clipboard::GetPlainTextFormatType() { |
611 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeText)); | 623 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeText)); |
612 return type; | 624 return type; |
613 } | 625 } |
614 | 626 |
615 // static | 627 // static |
616 const Clipboard::FormatType& Clipboard::GetPlainTextWFormatType() { | 628 const Clipboard::FormatType& Clipboard::GetPlainTextWFormatType() { |
617 return GetPlainTextFormatType(); | 629 return GetPlainTextFormatType(); |
618 } | 630 } |
619 | 631 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 return type; | 664 return type; |
653 } | 665 } |
654 | 666 |
655 // static | 667 // static |
656 const Clipboard::FormatType& Clipboard::GetWebCustomDataFormatType() { | 668 const Clipboard::FormatType& Clipboard::GetWebCustomDataFormatType() { |
657 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeWebCustomData)); | 669 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeWebCustomData)); |
658 return type; | 670 return type; |
659 } | 671 } |
660 | 672 |
661 } // namespace ui | 673 } // namespace ui |
OLD | NEW |