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 "webkit/common/webdropdata.h" | 5 #include "webkit/common/webdropdata.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 WebDropData::FileInfo::FileInfo() { | 24 WebDropData::FileInfo::FileInfo() { |
25 } | 25 } |
26 | 26 |
27 WebDropData::FileInfo::FileInfo(const base::string16& path, | 27 WebDropData::FileInfo::FileInfo(const base::string16& path, |
28 const base::string16& display_name) | 28 const base::string16& display_name) |
29 : path(path), | 29 : path(path), |
30 display_name(display_name) { | 30 display_name(display_name) { |
31 } | 31 } |
32 | 32 |
33 WebDropData::WebDropData(const WebDragData& drag_data) | 33 WebDropData::WebDropData(const WebDragData& drag_data) |
34 : referrer_policy(WebKit::WebReferrerPolicyDefault), | 34 : referrer_policy(WebKit::WebReferrerPolicyDefault) { |
35 text(base::NullableString16(true)), | |
36 html(base::NullableString16(true)) { | |
37 const WebVector<WebDragData::Item>& item_list = drag_data.items(); | 35 const WebVector<WebDragData::Item>& item_list = drag_data.items(); |
38 for (size_t i = 0; i < item_list.size(); ++i) { | 36 for (size_t i = 0; i < item_list.size(); ++i) { |
39 const WebDragData::Item& item = item_list[i]; | 37 const WebDragData::Item& item = item_list[i]; |
40 switch (item.storageType) { | 38 switch (item.storageType) { |
41 case WebDragData::Item::StorageTypeString: { | 39 case WebDragData::Item::StorageTypeString: { |
42 if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeText)) { | 40 if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeText)) { |
43 text = base::NullableString16(item.stringData, false); | 41 text = base::NullableString16(item.stringData, false); |
44 break; | 42 break; |
45 } | 43 } |
46 if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeURIList)) { | 44 if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeURIList)) { |
(...skipping 21 matching lines...) Expand all Loading... |
68 case WebDragData::Item::StorageTypeFilename: | 66 case WebDragData::Item::StorageTypeFilename: |
69 // TODO(varunjain): This only works on chromeos. Support win/mac/gtk. | 67 // TODO(varunjain): This only works on chromeos. Support win/mac/gtk. |
70 filenames.push_back(FileInfo(item.filenameData, | 68 filenames.push_back(FileInfo(item.filenameData, |
71 item.displayNameData)); | 69 item.displayNameData)); |
72 break; | 70 break; |
73 } | 71 } |
74 } | 72 } |
75 } | 73 } |
76 | 74 |
77 WebDropData::WebDropData() | 75 WebDropData::WebDropData() |
78 : referrer_policy(WebKit::WebReferrerPolicyDefault), | 76 : referrer_policy(WebKit::WebReferrerPolicyDefault) { |
79 text(base::NullableString16(true)), | |
80 html(base::NullableString16(true)) { | |
81 } | 77 } |
82 | 78 |
83 WebDropData::~WebDropData() { | 79 WebDropData::~WebDropData() { |
84 } | 80 } |
OLD | NEW |