| 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_aura.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "third_party/skia/include/core/SkBitmap.h" | 15 #include "third_party/skia/include/core/SkBitmap.h" |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 return current_data_; | 399 return current_data_; |
| 400 } | 400 } |
| 401 | 401 |
| 402 static ClipboardData* current_data_; | 402 static ClipboardData* current_data_; |
| 403 }; | 403 }; |
| 404 | 404 |
| 405 ClipboardData* ClipboardDataBuilder::current_data_ = NULL; | 405 ClipboardData* ClipboardDataBuilder::current_data_ = NULL; |
| 406 | 406 |
| 407 } // namespace | 407 } // namespace |
| 408 | 408 |
| 409 // Clipboard::FormatType implementation. |
| 409 Clipboard::FormatType::FormatType() { | 410 Clipboard::FormatType::FormatType() { |
| 410 } | 411 } |
| 411 | 412 |
| 412 Clipboard::FormatType::FormatType(const std::string& native_format) | 413 Clipboard::FormatType::FormatType(const std::string& native_format) |
| 413 : data_(native_format) { | 414 : data_(native_format) { |
| 414 } | 415 } |
| 415 | 416 |
| 416 Clipboard::FormatType::~FormatType() { | 417 Clipboard::FormatType::~FormatType() { |
| 417 } | 418 } |
| 418 | 419 |
| 419 std::string Clipboard::FormatType::Serialize() const { | 420 std::string Clipboard::FormatType::Serialize() const { |
| 420 return data_; | 421 return data_; |
| 421 } | 422 } |
| 422 | 423 |
| 423 // static | 424 // static |
| 424 Clipboard::FormatType Clipboard::FormatType::Deserialize( | 425 Clipboard::FormatType Clipboard::FormatType::Deserialize( |
| 425 const std::string& serialization) { | 426 const std::string& serialization) { |
| 426 return FormatType(serialization); | 427 return FormatType(serialization); |
| 427 } | 428 } |
| 428 | 429 |
| 429 bool Clipboard::FormatType::operator<(const FormatType& other) const { | 430 bool Clipboard::FormatType::operator<(const FormatType& other) const { |
| 430 return data_ < other.data_; | 431 return data_ < other.data_; |
| 431 } | 432 } |
| 432 | 433 |
| 433 bool Clipboard::FormatType::Equals(const FormatType& other) const { | 434 bool Clipboard::FormatType::Equals(const FormatType& other) const { |
| 434 return data_ == other.data_; | 435 return data_ == other.data_; |
| 435 } | 436 } |
| 436 | 437 |
| 437 Clipboard::Clipboard() { | 438 // Miscellaneous Clipboard definitions. |
| 439 // static |
| 440 Clipboard::FormatType Clipboard::GetFormatType( |
| 441 const std::string& format_string) { |
| 442 return FormatType::Deserialize(format_string); |
| 443 } |
| 444 |
| 445 // static |
| 446 const Clipboard::FormatType& Clipboard::GetUrlFormatType() { |
| 447 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeURIList)); |
| 448 return type; |
| 449 } |
| 450 |
| 451 // static |
| 452 const Clipboard::FormatType& Clipboard::GetUrlWFormatType() { |
| 453 return GetUrlFormatType(); |
| 454 } |
| 455 |
| 456 // static |
| 457 const Clipboard::FormatType& Clipboard::GetPlainTextFormatType() { |
| 458 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeText)); |
| 459 return type; |
| 460 } |
| 461 |
| 462 // static |
| 463 const Clipboard::FormatType& Clipboard::GetPlainTextWFormatType() { |
| 464 return GetPlainTextFormatType(); |
| 465 } |
| 466 |
| 467 // static |
| 468 const Clipboard::FormatType& Clipboard::GetFilenameFormatType() { |
| 469 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeFilename)); |
| 470 return type; |
| 471 } |
| 472 |
| 473 // static |
| 474 const Clipboard::FormatType& Clipboard::GetFilenameWFormatType() { |
| 475 return Clipboard::GetFilenameFormatType(); |
| 476 } |
| 477 |
| 478 // static |
| 479 const Clipboard::FormatType& Clipboard::GetHtmlFormatType() { |
| 480 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeHTML)); |
| 481 return type; |
| 482 } |
| 483 |
| 484 // static |
| 485 const Clipboard::FormatType& Clipboard::GetRtfFormatType() { |
| 486 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeRTF)); |
| 487 return type; |
| 488 } |
| 489 |
| 490 // static |
| 491 const Clipboard::FormatType& Clipboard::GetBitmapFormatType() { |
| 492 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeBitmap)); |
| 493 return type; |
| 494 } |
| 495 |
| 496 // static |
| 497 const Clipboard::FormatType& Clipboard::GetWebKitSmartPasteFormatType() { |
| 498 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeWebkitSmartPaste)); |
| 499 return type; |
| 500 } |
| 501 |
| 502 // static |
| 503 const Clipboard::FormatType& Clipboard::GetWebCustomDataFormatType() { |
| 504 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeWebCustomData)); |
| 505 return type; |
| 506 } |
| 507 |
| 508 // static |
| 509 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() { |
| 510 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypePepperCustomData)); |
| 511 return type; |
| 512 } |
| 513 |
| 514 Clipboard* Clipboard::Create() { |
| 515 return new ClipboardAura; |
| 516 } |
| 517 |
| 518 // ClipboardAura implementation. |
| 519 ClipboardAura::ClipboardAura() { |
| 438 DCHECK(CalledOnValidThread()); | 520 DCHECK(CalledOnValidThread()); |
| 439 // Make sure clipboard is created. | 521 // Make sure clipboard is created. |
| 440 GetClipboard(); | 522 GetClipboard(); |
| 441 } | 523 } |
| 442 | 524 |
| 443 Clipboard::~Clipboard() { | 525 ClipboardAura::~ClipboardAura() { |
| 444 DCHECK(CalledOnValidThread()); | 526 DCHECK(CalledOnValidThread()); |
| 445 DeleteClipboard(); | 527 DeleteClipboard(); |
| 446 } | 528 } |
| 447 | 529 |
| 448 void Clipboard::WriteObjects(ClipboardType type, const ObjectMap& objects) { | 530 uint64 ClipboardAura::GetSequenceNumber(ClipboardType type) { |
| 449 DCHECK(CalledOnValidThread()); | 531 DCHECK(CalledOnValidThread()); |
| 450 DCHECK(IsSupportedClipboardType(type)); | 532 return GetClipboard()->sequence_number(); |
| 451 for (ObjectMap::const_iterator iter = objects.begin(); | |
| 452 iter != objects.end(); ++iter) { | |
| 453 DispatchObject(static_cast<ObjectType>(iter->first), iter->second); | |
| 454 } | |
| 455 ClipboardDataBuilder::CommitToClipboard(); | |
| 456 } | 533 } |
| 457 | 534 |
| 458 bool Clipboard::IsFormatAvailable(const FormatType& format, | 535 bool ClipboardAura::IsFormatAvailable(const FormatType& format, |
| 459 ClipboardType type) const { | 536 ClipboardType type) const { |
| 460 DCHECK(CalledOnValidThread()); | 537 DCHECK(CalledOnValidThread()); |
| 461 DCHECK(IsSupportedClipboardType(type)); | 538 DCHECK(IsSupportedClipboardType(type)); |
| 462 AuraClipboard* clipboard = GetClipboard(); | 539 AuraClipboard* clipboard = GetClipboard(); |
| 463 if (GetPlainTextFormatType().Equals(format) || | 540 if (GetPlainTextFormatType().Equals(format) || |
| 464 GetUrlFormatType().Equals(format)) | 541 GetUrlFormatType().Equals(format)) |
| 465 return clipboard->IsFormatAvailable(TEXT); | 542 return clipboard->IsFormatAvailable(TEXT); |
| 466 else if (GetHtmlFormatType().Equals(format)) | 543 else if (GetHtmlFormatType().Equals(format)) |
| 467 return clipboard->IsFormatAvailable(HTML); | 544 return clipboard->IsFormatAvailable(HTML); |
| 468 else if (GetRtfFormatType().Equals(format)) | 545 else if (GetRtfFormatType().Equals(format)) |
| 469 return clipboard->IsFormatAvailable(RTF); | 546 return clipboard->IsFormatAvailable(RTF); |
| 470 else if (GetBitmapFormatType().Equals(format)) | 547 else if (GetBitmapFormatType().Equals(format)) |
| 471 return clipboard->IsFormatAvailable(BITMAP); | 548 return clipboard->IsFormatAvailable(BITMAP); |
| 472 else if (GetWebKitSmartPasteFormatType().Equals(format)) | 549 else if (GetWebKitSmartPasteFormatType().Equals(format)) |
| 473 return clipboard->IsFormatAvailable(WEB); | 550 return clipboard->IsFormatAvailable(WEB); |
| 474 else { | 551 else { |
| 475 const ClipboardData* data = clipboard->GetData(); | 552 const ClipboardData* data = clipboard->GetData(); |
| 476 if (data && data->custom_data_format() == format.ToString()) | 553 if (data && data->custom_data_format() == format.ToString()) |
| 477 return true; | 554 return true; |
| 478 } | 555 } |
| 479 return false; | 556 return false; |
| 480 } | 557 } |
| 481 | 558 |
| 482 void Clipboard::Clear(ClipboardType type) { | 559 void ClipboardAura::Clear(ClipboardType type) { |
| 483 DCHECK(CalledOnValidThread()); | 560 DCHECK(CalledOnValidThread()); |
| 484 DCHECK(IsSupportedClipboardType(type)); | 561 DCHECK(IsSupportedClipboardType(type)); |
| 485 AuraClipboard* clipboard = GetClipboard(); | 562 AuraClipboard* clipboard = GetClipboard(); |
| 486 clipboard->Clear(); | 563 clipboard->Clear(); |
| 487 } | 564 } |
| 488 | 565 |
| 489 void Clipboard::ReadAvailableTypes(ClipboardType type, | 566 void ClipboardAura::ReadAvailableTypes(ClipboardType type, |
| 490 std::vector<base::string16>* types, | 567 std::vector<base::string16>* types, |
| 491 bool* contains_filenames) const { | 568 bool* contains_filenames) const { |
| 492 DCHECK(CalledOnValidThread()); | 569 DCHECK(CalledOnValidThread()); |
| 493 if (!types || !contains_filenames) { | 570 if (!types || !contains_filenames) { |
| 494 NOTREACHED(); | 571 NOTREACHED(); |
| 495 return; | 572 return; |
| 496 } | 573 } |
| 497 | 574 |
| 498 types->clear(); | 575 types->clear(); |
| 499 *contains_filenames = false; | 576 *contains_filenames = false; |
| 500 if (IsFormatAvailable(GetPlainTextFormatType(), type)) | 577 if (IsFormatAvailable(GetPlainTextFormatType(), type)) |
| 501 types->push_back(base::UTF8ToUTF16(GetPlainTextFormatType().ToString())); | 578 types->push_back(base::UTF8ToUTF16(GetPlainTextFormatType().ToString())); |
| 502 if (IsFormatAvailable(GetHtmlFormatType(), type)) | 579 if (IsFormatAvailable(GetHtmlFormatType(), type)) |
| 503 types->push_back(base::UTF8ToUTF16(GetHtmlFormatType().ToString())); | 580 types->push_back(base::UTF8ToUTF16(GetHtmlFormatType().ToString())); |
| 504 if (IsFormatAvailable(GetRtfFormatType(), type)) | 581 if (IsFormatAvailable(GetRtfFormatType(), type)) |
| 505 types->push_back(base::UTF8ToUTF16(GetRtfFormatType().ToString())); | 582 types->push_back(base::UTF8ToUTF16(GetRtfFormatType().ToString())); |
| 506 if (IsFormatAvailable(GetBitmapFormatType(), type)) | 583 if (IsFormatAvailable(GetBitmapFormatType(), type)) |
| 507 types->push_back(base::UTF8ToUTF16(kMimeTypePNG)); | 584 types->push_back(base::UTF8ToUTF16(kMimeTypePNG)); |
| 508 | 585 |
| 509 AuraClipboard* clipboard = GetClipboard(); | 586 AuraClipboard* clipboard = GetClipboard(); |
| 510 if (clipboard->IsFormatAvailable(CUSTOM) && clipboard->GetData()) { | 587 if (clipboard->IsFormatAvailable(CUSTOM) && clipboard->GetData()) { |
| 511 ui::ReadCustomDataTypes(clipboard->GetData()->custom_data_data().c_str(), | 588 ui::ReadCustomDataTypes(clipboard->GetData()->custom_data_data().c_str(), |
| 512 clipboard->GetData()->custom_data_data().size(), types); | 589 clipboard->GetData()->custom_data_data().size(), types); |
| 513 } | 590 } |
| 514 } | 591 } |
| 515 | 592 |
| 516 void Clipboard::ReadText(ClipboardType type, base::string16* result) const { | 593 void ClipboardAura::ReadText(ClipboardType type, base::string16* result) const { |
| 517 DCHECK(CalledOnValidThread()); | 594 DCHECK(CalledOnValidThread()); |
| 518 GetClipboard()->ReadText(result); | 595 GetClipboard()->ReadText(result); |
| 519 } | 596 } |
| 520 | 597 |
| 521 void Clipboard::ReadAsciiText(ClipboardType type, std::string* result) const { | 598 void ClipboardAura::ReadAsciiText(ClipboardType type, |
| 599 std::string* result) const { |
| 522 DCHECK(CalledOnValidThread()); | 600 DCHECK(CalledOnValidThread()); |
| 523 GetClipboard()->ReadAsciiText(result); | 601 GetClipboard()->ReadAsciiText(result); |
| 524 } | 602 } |
| 525 | 603 |
| 526 void Clipboard::ReadHTML(ClipboardType type, | 604 void ClipboardAura::ReadHTML(ClipboardType type, |
| 527 base::string16* markup, | 605 base::string16* markup, |
| 528 std::string* src_url, | 606 std::string* src_url, |
| 529 uint32* fragment_start, | 607 uint32* fragment_start, |
| 530 uint32* fragment_end) const { | 608 uint32* fragment_end) const { |
| 531 DCHECK(CalledOnValidThread()); | 609 DCHECK(CalledOnValidThread()); |
| 532 GetClipboard()->ReadHTML(markup, src_url, fragment_start, fragment_end); | 610 GetClipboard()->ReadHTML(markup, src_url, fragment_start, fragment_end); |
| 533 } | 611 } |
| 534 | 612 |
| 535 void Clipboard::ReadRTF(ClipboardType type, std::string* result) const { | 613 void ClipboardAura::ReadRTF(ClipboardType type, std::string* result) const { |
| 536 DCHECK(CalledOnValidThread()); | 614 DCHECK(CalledOnValidThread()); |
| 537 GetClipboard()->ReadRTF(result); | 615 GetClipboard()->ReadRTF(result); |
| 538 } | 616 } |
| 539 | 617 |
| 540 SkBitmap Clipboard::ReadImage(ClipboardType type) const { | 618 SkBitmap ClipboardAura::ReadImage(ClipboardType type) const { |
| 541 DCHECK(CalledOnValidThread()); | 619 DCHECK(CalledOnValidThread()); |
| 542 return GetClipboard()->ReadImage(); | 620 return GetClipboard()->ReadImage(); |
| 543 } | 621 } |
| 544 | 622 |
| 545 void Clipboard::ReadCustomData(ClipboardType clipboard_type, | 623 void ClipboardAura::ReadCustomData(ClipboardType clipboard_type, |
| 546 const base::string16& type, | 624 const base::string16& type, |
| 547 base::string16* result) const { | 625 base::string16* result) const { |
| 548 DCHECK(CalledOnValidThread()); | 626 DCHECK(CalledOnValidThread()); |
| 549 GetClipboard()->ReadCustomData(type, result); | 627 GetClipboard()->ReadCustomData(type, result); |
| 550 } | 628 } |
| 551 | 629 |
| 552 void Clipboard::ReadBookmark(base::string16* title, std::string* url) const { | 630 void ClipboardAura::ReadBookmark(base::string16* title, |
| 631 std::string* url) const { |
| 553 DCHECK(CalledOnValidThread()); | 632 DCHECK(CalledOnValidThread()); |
| 554 GetClipboard()->ReadBookmark(title, url); | 633 GetClipboard()->ReadBookmark(title, url); |
| 555 } | 634 } |
| 556 | 635 |
| 557 void Clipboard::ReadData(const FormatType& format, std::string* result) const { | 636 void ClipboardAura::ReadData(const FormatType& format, |
| 637 std::string* result) const { |
| 558 DCHECK(CalledOnValidThread()); | 638 DCHECK(CalledOnValidThread()); |
| 559 GetClipboard()->ReadData(format.ToString(), result); | 639 GetClipboard()->ReadData(format.ToString(), result); |
| 560 } | 640 } |
| 561 | 641 |
| 562 uint64 Clipboard::GetSequenceNumber(ClipboardType type) { | 642 void ClipboardAura::WriteObjects(ClipboardType type, const ObjectMap& objects) { |
| 563 DCHECK(CalledOnValidThread()); | 643 DCHECK(CalledOnValidThread()); |
| 564 return GetClipboard()->sequence_number(); | 644 DCHECK(IsSupportedClipboardType(type)); |
| 645 for (ObjectMap::const_iterator iter = objects.begin(); iter != objects.end(); |
| 646 ++iter) { |
| 647 DispatchObject(static_cast<ObjectType>(iter->first), iter->second); |
| 648 } |
| 649 ClipboardDataBuilder::CommitToClipboard(); |
| 565 } | 650 } |
| 566 | 651 |
| 567 void Clipboard::WriteText(const char* text_data, size_t text_len) { | 652 void ClipboardAura::WriteText(const char* text_data, size_t text_len) { |
| 568 ClipboardDataBuilder::WriteText(text_data, text_len); | 653 ClipboardDataBuilder::WriteText(text_data, text_len); |
| 569 } | 654 } |
| 570 | 655 |
| 571 void Clipboard::WriteHTML(const char* markup_data, | 656 void ClipboardAura::WriteHTML(const char* markup_data, |
| 572 size_t markup_len, | 657 size_t markup_len, |
| 573 const char* url_data, | 658 const char* url_data, |
| 574 size_t url_len) { | 659 size_t url_len) { |
| 575 ClipboardDataBuilder::WriteHTML(markup_data, markup_len, url_data, url_len); | 660 ClipboardDataBuilder::WriteHTML(markup_data, markup_len, url_data, url_len); |
| 576 } | 661 } |
| 577 | 662 |
| 578 void Clipboard::WriteRTF(const char* rtf_data, size_t data_len) { | 663 void ClipboardAura::WriteRTF(const char* rtf_data, size_t data_len) { |
| 579 ClipboardDataBuilder::WriteRTF(rtf_data, data_len); | 664 ClipboardDataBuilder::WriteRTF(rtf_data, data_len); |
| 580 } | 665 } |
| 581 | 666 |
| 582 void Clipboard::WriteBookmark(const char* title_data, | 667 void ClipboardAura::WriteBookmark(const char* title_data, |
| 583 size_t title_len, | 668 size_t title_len, |
| 584 const char* url_data, | 669 const char* url_data, |
| 585 size_t url_len) { | 670 size_t url_len) { |
| 586 ClipboardDataBuilder::WriteBookmark(title_data, title_len, url_data, url_len); | 671 ClipboardDataBuilder::WriteBookmark(title_data, title_len, url_data, url_len); |
| 587 } | 672 } |
| 588 | 673 |
| 589 void Clipboard::WriteWebSmartPaste() { | 674 void ClipboardAura::WriteWebSmartPaste() { |
| 590 ClipboardDataBuilder::WriteWebSmartPaste(); | 675 ClipboardDataBuilder::WriteWebSmartPaste(); |
| 591 } | 676 } |
| 592 | 677 |
| 593 void Clipboard::WriteBitmap(const SkBitmap& bitmap) { | 678 void ClipboardAura::WriteBitmap(const SkBitmap& bitmap) { |
| 594 ClipboardDataBuilder::WriteBitmap(bitmap); | 679 ClipboardDataBuilder::WriteBitmap(bitmap); |
| 595 } | 680 } |
| 596 | 681 |
| 597 void Clipboard::WriteData(const FormatType& format, | 682 void ClipboardAura::WriteData(const FormatType& format, |
| 598 const char* data_data, | 683 const char* data_data, |
| 599 size_t data_len) { | 684 size_t data_len) { |
| 600 ClipboardDataBuilder::WriteData(format.ToString(), data_data, data_len); | 685 ClipboardDataBuilder::WriteData(format.ToString(), data_data, data_len); |
| 601 } | 686 } |
| 602 | 687 |
| 603 // static | |
| 604 Clipboard::FormatType Clipboard::GetFormatType( | |
| 605 const std::string& format_string) { | |
| 606 return FormatType::Deserialize(format_string); | |
| 607 } | |
| 608 | |
| 609 // static | |
| 610 const Clipboard::FormatType& Clipboard::GetUrlFormatType() { | |
| 611 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeURIList)); | |
| 612 return type; | |
| 613 } | |
| 614 | |
| 615 // static | |
| 616 const Clipboard::FormatType& Clipboard::GetUrlWFormatType() { | |
| 617 return GetUrlFormatType(); | |
| 618 } | |
| 619 | |
| 620 // static | |
| 621 const Clipboard::FormatType& Clipboard::GetPlainTextFormatType() { | |
| 622 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeText)); | |
| 623 return type; | |
| 624 } | |
| 625 | |
| 626 // static | |
| 627 const Clipboard::FormatType& Clipboard::GetPlainTextWFormatType() { | |
| 628 return GetPlainTextFormatType(); | |
| 629 } | |
| 630 | |
| 631 // static | |
| 632 const Clipboard::FormatType& Clipboard::GetFilenameFormatType() { | |
| 633 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeFilename)); | |
| 634 return type; | |
| 635 } | |
| 636 | |
| 637 // static | |
| 638 const Clipboard::FormatType& Clipboard::GetFilenameWFormatType() { | |
| 639 return Clipboard::GetFilenameFormatType(); | |
| 640 } | |
| 641 | |
| 642 // static | |
| 643 const Clipboard::FormatType& Clipboard::GetHtmlFormatType() { | |
| 644 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeHTML)); | |
| 645 return type; | |
| 646 } | |
| 647 | |
| 648 // static | |
| 649 const Clipboard::FormatType& Clipboard::GetRtfFormatType() { | |
| 650 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeRTF)); | |
| 651 return type; | |
| 652 } | |
| 653 | |
| 654 // static | |
| 655 const Clipboard::FormatType& Clipboard::GetBitmapFormatType() { | |
| 656 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeBitmap)); | |
| 657 return type; | |
| 658 } | |
| 659 | |
| 660 // static | |
| 661 const Clipboard::FormatType& Clipboard::GetWebKitSmartPasteFormatType() { | |
| 662 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeWebkitSmartPaste)); | |
| 663 return type; | |
| 664 } | |
| 665 | |
| 666 // static | |
| 667 const Clipboard::FormatType& Clipboard::GetWebCustomDataFormatType() { | |
| 668 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeWebCustomData)); | |
| 669 return type; | |
| 670 } | |
| 671 | |
| 672 // static | |
| 673 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() { | |
| 674 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypePepperCustomData)); | |
| 675 return type; | |
| 676 } | |
| 677 | |
| 678 } // namespace ui | 688 } // namespace ui |
| OLD | NEW |