Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: ui/base/clipboard/clipboard_win.cc

Issue 8418034: Make string_util::WriteInto() DCHECK() that the supplied |length_with_null| > 1, meaning that the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 597
598 HDROP drop = static_cast<HDROP>(::GetClipboardData(CF_HDROP)); 598 HDROP drop = static_cast<HDROP>(::GetClipboardData(CF_HDROP));
599 if (!drop) 599 if (!drop)
600 return; 600 return;
601 601
602 // Count of files in the HDROP. 602 // Count of files in the HDROP.
603 int count = ::DragQueryFile(drop, 0xffffffff, NULL, 0); 603 int count = ::DragQueryFile(drop, 0xffffffff, NULL, 0);
604 604
605 if (count) { 605 if (count) {
606 for (int i = 0; i < count; ++i) { 606 for (int i = 0; i < count; ++i) {
607 int size = ::DragQueryFile(drop, i, NULL, 0) + 1; 607 UINT size = ::DragQueryFile(drop, i, NULL, 0) + 1;
608 DCHECK_GT(size, 1u);
608 std::wstring file; 609 std::wstring file;
609 ::DragQueryFile(drop, i, WriteInto(&file, size), size); 610 ::DragQueryFile(drop, i, WriteInto(&file, size), size);
610 files->push_back(FilePath(file)); 611 files->push_back(FilePath(file));
611 } 612 }
612 } 613 }
613 } 614 }
614 615
615 void Clipboard::ReadData(const std::string& format, std::string* result) { 616 void Clipboard::ReadData(const std::string& format, std::string* result) {
616 if (!result) { 617 if (!result) {
617 NOTREACHED(); 618 NOTREACHED();
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 clipboard_owner_ = ::CreateWindow(L"ClipboardOwnerWindowClass", 742 clipboard_owner_ = ::CreateWindow(L"ClipboardOwnerWindowClass",
742 L"ClipboardOwnerWindow", 743 L"ClipboardOwnerWindow",
743 0, 0, 0, 0, 0, 744 0, 0, 0, 0, 0,
744 HWND_MESSAGE, 745 HWND_MESSAGE,
745 0, 0, 0); 746 0, 0, 0);
746 } 747 }
747 return clipboard_owner_; 748 return clipboard_owner_;
748 } 749 }
749 750
750 } // namespace ui 751 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698