OLD | NEW |
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" |
| 11 #include "third_party/WebKit/public/platform/FilePathConversion.h" |
11 #include "third_party/WebKit/public/platform/URLConversion.h" | 12 #include "third_party/WebKit/public/platform/URLConversion.h" |
12 #include "third_party/WebKit/public/platform/WebDragData.h" | 13 #include "third_party/WebKit/public/platform/WebDragData.h" |
13 #include "third_party/WebKit/public/platform/WebString.h" | 14 #include "third_party/WebKit/public/platform/WebString.h" |
14 #include "third_party/WebKit/public/platform/WebVector.h" | 15 #include "third_party/WebKit/public/platform/WebVector.h" |
15 #include "ui/base/clipboard/clipboard.h" | 16 #include "ui/base/clipboard/clipboard.h" |
16 | 17 |
17 using blink::WebDragData; | 18 using blink::WebDragData; |
18 using blink::WebVector; | 19 using blink::WebVector; |
19 | 20 |
20 namespace content { | 21 namespace content { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 break; | 54 break; |
54 } | 55 } |
55 case WebDragData::Item::StorageTypeBinaryData: | 56 case WebDragData::Item::StorageTypeBinaryData: |
56 result.file_contents.assign(item.binaryData.data(), | 57 result.file_contents.assign(item.binaryData.data(), |
57 item.binaryData.size()); | 58 item.binaryData.size()); |
58 result.file_description_filename = item.title; | 59 result.file_description_filename = item.title; |
59 break; | 60 break; |
60 case WebDragData::Item::StorageTypeFilename: | 61 case WebDragData::Item::StorageTypeFilename: |
61 // TODO(varunjain): This only works on chromeos. Support win/mac/gtk. | 62 // TODO(varunjain): This only works on chromeos. Support win/mac/gtk. |
62 result.filenames.push_back(ui::FileInfo( | 63 result.filenames.push_back(ui::FileInfo( |
63 base::FilePath::FromUTF16Unsafe(item.filenameData), | 64 blink::WebStringToFilePath(item.filenameData), |
64 base::FilePath::FromUTF16Unsafe(item.displayNameData))); | 65 blink::WebStringToFilePath(item.displayNameData))); |
65 break; | 66 break; |
66 case WebDragData::Item::StorageTypeFileSystemFile: { | 67 case WebDragData::Item::StorageTypeFileSystemFile: { |
67 DropData::FileSystemFileInfo info; | 68 DropData::FileSystemFileInfo info; |
68 info.url = item.fileSystemURL; | 69 info.url = item.fileSystemURL; |
69 info.size = item.fileSystemFileSize; | 70 info.size = item.fileSystemFileSize; |
70 result.file_system_files.push_back(info); | 71 result.file_system_files.push_back(info); |
71 break; | 72 break; |
72 } | 73 } |
73 } | 74 } |
74 } | 75 } |
75 | 76 |
76 return result; | 77 return result; |
77 } | 78 } |
78 | 79 |
79 } // namespace content | 80 } // namespace content |
OLD | NEW |