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

Side by Side Diff: content/renderer/drop_data_builder.cc

Issue 2674953003: Only generate suggested filenames when actually dragging an image. (Closed)
Patch Set: Maybe? Created 3 years, 10 months 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/drop_data_builder.h" 5 #include "content/renderer/drop_data_builder.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "content/public/common/drop_data.h" 10 #include "content/public/common/drop_data.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 result.html_base_url = item.baseURL; 51 result.html_base_url = item.baseURL;
52 break; 52 break;
53 } 53 }
54 result.custom_data.insert( 54 result.custom_data.insert(
55 std::make_pair(item.stringType.utf16(), item.stringData.utf16())); 55 std::make_pair(item.stringType.utf16(), item.stringData.utf16()));
56 break; 56 break;
57 } 57 }
58 case WebDragData::Item::StorageTypeBinaryData: 58 case WebDragData::Item::StorageTypeBinaryData:
59 result.file_contents.assign(item.binaryData.data(), 59 result.file_contents.assign(item.binaryData.data(),
60 item.binaryData.size()); 60 item.binaryData.size());
61 result.file_description_filename = item.title.utf16(); 61 result.file_contents_source_url = item.binaryDataSourceURL;
62 #if defined(OS_WIN)
63 result.file_contents_filename_extension =
64 item.binaryDataFilenameExtension.utf16();
65 #else
66 result.file_contents_filename_extension =
67 item.binaryDataFilenameExtension.utf8();
kinuko 2017/02/06 22:24:58 nit: WebStringToFilePath(...).value();
68 #endif
69 result.file_contents_content_disposition =
70 item.binaryDataContentDisposition.utf8();
62 break; 71 break;
63 case WebDragData::Item::StorageTypeFilename: 72 case WebDragData::Item::StorageTypeFilename:
64 // TODO(varunjain): This only works on chromeos. Support win/mac/gtk. 73 // TODO(varunjain): This only works on chromeos. Support win/mac/gtk.
65 result.filenames.push_back(ui::FileInfo( 74 result.filenames.push_back(ui::FileInfo(
66 blink::WebStringToFilePath(item.filenameData), 75 blink::WebStringToFilePath(item.filenameData),
67 blink::WebStringToFilePath(item.displayNameData))); 76 blink::WebStringToFilePath(item.displayNameData)));
68 break; 77 break;
69 case WebDragData::Item::StorageTypeFileSystemFile: { 78 case WebDragData::Item::StorageTypeFileSystemFile: {
70 DropData::FileSystemFileInfo info; 79 DropData::FileSystemFileInfo info;
71 info.url = item.fileSystemURL; 80 info.url = item.fileSystemURL;
72 info.size = item.fileSystemFileSize; 81 info.size = item.fileSystemFileSize;
73 info.filesystem_id = item.fileSystemId.ascii(); 82 info.filesystem_id = item.fileSystemId.ascii();
74 result.file_system_files.push_back(info); 83 result.file_system_files.push_back(info);
75 break; 84 break;
76 } 85 }
77 } 86 }
78 } 87 }
79 88
80 return result; 89 return result;
81 } 90 }
82 91
83 } // namespace content 92 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698