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

Side by Side Diff: Source/core/page/DragData.cpp

Issue 720403002: Let input tag filter out non-native files in dropped data. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix test. Created 6 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
« no previous file with comments | « Source/core/page/DragData.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. 3 * Copyright (C) 2013 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 else if (filenamePolicy == ConvertFilenames && containsFiles()) 78 else if (filenamePolicy == ConvertFilenames && containsFiles())
79 url = filePathToURL(m_platformDragData->filenames()[0]); 79 url = filePathToURL(m_platformDragData->filenames()[0]);
80 return url; 80 return url;
81 } 81 }
82 82
83 bool DragData::containsFiles() const 83 bool DragData::containsFiles() const
84 { 84 {
85 return m_platformDragData->containsFilenames(); 85 return m_platformDragData->containsFilenames();
86 } 86 }
87 87
88 unsigned DragData::numberOfFiles() const
89 {
90 return m_platformDragData->filenames().size();
91 }
92
93 int DragData::modifierKeyState() const 88 int DragData::modifierKeyState() const
94 { 89 {
95 return m_platformDragData->modifierKeyState(); 90 return m_platformDragData->modifierKeyState();
96 } 91 }
97 92
98 void DragData::asFilenames(Vector<String>& result) const 93 void DragData::asFilePaths(Vector<String>& result) const
99 { 94 {
100 const Vector<String>& filenames = m_platformDragData->filenames(); 95 const Vector<String>& filenames = m_platformDragData->filenames();
101 for (size_t i = 0; i < filenames.size(); ++i) 96 for (size_t i = 0; i < filenames.size(); ++i) {
102 result.append(filenames[i]); 97 if (!filenames[i].isEmpty())
98 result.append(filenames[i]);
99 }
103 } 100 }
104 101
105 bool DragData::containsPlainText() const 102 bool DragData::containsPlainText() const
106 { 103 {
107 return m_platformDragData->types().contains(mimeTypeTextPlain); 104 return m_platformDragData->types().contains(mimeTypeTextPlain);
108 } 105 }
109 106
110 String DragData::asPlainText() const 107 String DragData::asPlainText() const
111 { 108 {
112 return m_platformDragData->getData(mimeTypeTextPlain); 109 return m_platformDragData->getData(mimeTypeTextPlain);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 155
159 return nullptr; 156 return nullptr;
160 } 157 }
161 158
162 String DragData::droppedFileSystemId() const 159 String DragData::droppedFileSystemId() const
163 { 160 {
164 return m_platformDragData->filesystemId(); 161 return m_platformDragData->filesystemId();
165 } 162 }
166 163
167 } // namespace blink 164 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/page/DragData.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698