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 // 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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 | 592 |
593 HDROP drop = static_cast<HDROP>(::GetClipboardData(CF_HDROP)); | 593 HDROP drop = static_cast<HDROP>(::GetClipboardData(CF_HDROP)); |
594 if (!drop) | 594 if (!drop) |
595 return; | 595 return; |
596 | 596 |
597 // Count of files in the HDROP. | 597 // Count of files in the HDROP. |
598 int count = ::DragQueryFile(drop, 0xffffffff, NULL, 0); | 598 int count = ::DragQueryFile(drop, 0xffffffff, NULL, 0); |
599 | 599 |
600 if (count) { | 600 if (count) { |
601 for (int i = 0; i < count; ++i) { | 601 for (int i = 0; i < count; ++i) { |
602 int size = ::DragQueryFile(drop, i, NULL, 0) + 1; | 602 UINT size = ::DragQueryFile(drop, i, NULL, 0) + 1; |
| 603 DCHECK_GT(size, 1u); |
603 std::wstring file; | 604 std::wstring file; |
604 ::DragQueryFile(drop, i, WriteInto(&file, size), size); | 605 ::DragQueryFile(drop, i, WriteInto(&file, size), size); |
605 files->push_back(FilePath(file)); | 606 files->push_back(FilePath(file)); |
606 } | 607 } |
607 } | 608 } |
608 } | 609 } |
609 | 610 |
610 void Clipboard::ReadData(const std::string& format, std::string* result) { | 611 void Clipboard::ReadData(const std::string& format, std::string* result) { |
611 if (!result) { | 612 if (!result) { |
612 NOTREACHED(); | 613 NOTREACHED(); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 clipboard_owner_ = ::CreateWindow(L"ClipboardOwnerWindowClass", | 737 clipboard_owner_ = ::CreateWindow(L"ClipboardOwnerWindowClass", |
737 L"ClipboardOwnerWindow", | 738 L"ClipboardOwnerWindow", |
738 0, 0, 0, 0, 0, | 739 0, 0, 0, 0, 0, |
739 HWND_MESSAGE, | 740 HWND_MESSAGE, |
740 0, 0, 0); | 741 0, 0, 0); |
741 } | 742 } |
742 return clipboard_owner_; | 743 return clipboard_owner_; |
743 } | 744 } |
744 | 745 |
745 } // namespace ui | 746 } // namespace ui |
OLD | NEW |