| 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 // Many of these functions are based on those found in | 5 // Many of these functions are based on those found in |
| 6 // webkit/port/platform/PasteboardWin.cpp | 6 // webkit/port/platform/PasteboardWin.cpp |
| 7 | 7 |
| 8 #include "ui/base/clipboard/clipboard.h" | 8 #include "ui/base/clipboard/clipboard.h" |
| 9 | 9 |
| 10 #include <shlobj.h> | 10 #include <shlobj.h> |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 | 437 |
| 438 // Acquire the clipboard. | 438 // Acquire the clipboard. |
| 439 ScopedClipboard clipboard; | 439 ScopedClipboard clipboard; |
| 440 if (!clipboard.Acquire(GetClipboardWindow())) | 440 if (!clipboard.Acquire(GetClipboardWindow())) |
| 441 return; | 441 return; |
| 442 | 442 |
| 443 HANDLE data = ::GetClipboardData(CF_UNICODETEXT); | 443 HANDLE data = ::GetClipboardData(CF_UNICODETEXT); |
| 444 if (!data) | 444 if (!data) |
| 445 return; | 445 return; |
| 446 | 446 |
| 447 result->assign(static_cast<const char16*>(::GlobalLock(data))); | 447 result->assign(static_cast<const base::char16*>(::GlobalLock(data))); |
| 448 ::GlobalUnlock(data); | 448 ::GlobalUnlock(data); |
| 449 } | 449 } |
| 450 | 450 |
| 451 void Clipboard::ReadAsciiText(ClipboardType type, std::string* result) const { | 451 void Clipboard::ReadAsciiText(ClipboardType type, std::string* result) const { |
| 452 DCHECK_EQ(type, CLIPBOARD_TYPE_COPY_PASTE); | 452 DCHECK_EQ(type, CLIPBOARD_TYPE_COPY_PASTE); |
| 453 if (!result) { | 453 if (!result) { |
| 454 NOTREACHED(); | 454 NOTREACHED(); |
| 455 return; | 455 return; |
| 456 } | 456 } |
| 457 | 457 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 | 625 |
| 626 // Acquire the clipboard. | 626 // Acquire the clipboard. |
| 627 ScopedClipboard clipboard; | 627 ScopedClipboard clipboard; |
| 628 if (!clipboard.Acquire(GetClipboardWindow())) | 628 if (!clipboard.Acquire(GetClipboardWindow())) |
| 629 return; | 629 return; |
| 630 | 630 |
| 631 HANDLE data = ::GetClipboardData(GetUrlWFormatType().ToUINT()); | 631 HANDLE data = ::GetClipboardData(GetUrlWFormatType().ToUINT()); |
| 632 if (!data) | 632 if (!data) |
| 633 return; | 633 return; |
| 634 | 634 |
| 635 base::string16 bookmark(static_cast<const char16*>(::GlobalLock(data))); | 635 base::string16 bookmark(static_cast<const base::char16*>(::GlobalLock(data))); |
| 636 ::GlobalUnlock(data); | 636 ::GlobalUnlock(data); |
| 637 | 637 |
| 638 ParseBookmarkClipboardFormat(bookmark, title, url); | 638 ParseBookmarkClipboardFormat(bookmark, title, url); |
| 639 } | 639 } |
| 640 | 640 |
| 641 void Clipboard::ReadData(const FormatType& format, std::string* result) const { | 641 void Clipboard::ReadData(const FormatType& format, std::string* result) const { |
| 642 if (!result) { | 642 if (!result) { |
| 643 NOTREACHED(); | 643 NOTREACHED(); |
| 644 return; | 644 return; |
| 645 } | 645 } |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 if (!clipboard_owner_) | 825 if (!clipboard_owner_) |
| 826 return NULL; | 826 return NULL; |
| 827 | 827 |
| 828 if (clipboard_owner_->hwnd() == NULL) | 828 if (clipboard_owner_->hwnd() == NULL) |
| 829 clipboard_owner_->Create(base::Bind(&ClipboardOwnerWndProc)); | 829 clipboard_owner_->Create(base::Bind(&ClipboardOwnerWndProc)); |
| 830 | 830 |
| 831 return clipboard_owner_->hwnd(); | 831 return clipboard_owner_->hwnd(); |
| 832 } | 832 } |
| 833 | 833 |
| 834 } // namespace ui | 834 } // namespace ui |
| OLD | NEW |