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

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

Issue 1723763002: Add WebDragData to blink::WebView::dragtargetDrop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 9 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"
11 #include "third_party/WebKit/public/platform/URLConversion.h" 11 #include "third_party/WebKit/public/platform/URLConversion.h"
12 #include "third_party/WebKit/public/platform/WebDragData.h" 12 #include "third_party/WebKit/public/platform/WebDragData.h"
13 #include "third_party/WebKit/public/platform/WebString.h" 13 #include "third_party/WebKit/public/platform/WebString.h"
14 #include "third_party/WebKit/public/platform/WebVector.h" 14 #include "third_party/WebKit/public/platform/WebVector.h"
15 #include "ui/base/clipboard/clipboard.h" 15 #include "ui/base/clipboard/clipboard.h"
16 16
17 using blink::WebDragData; 17 using blink::WebDragData;
18 using blink::WebVector; 18 using blink::WebVector;
19 19
20 namespace content { 20 namespace content {
21 21
22 // static 22 // static
23 DropData DropDataBuilder::Build(const WebDragData& drag_data) { 23 DropData DropDataBuilder::Build(const WebDragData& drag_data) {
24 DropData result; 24 DropData result;
25 result.is_valid = !drag_data.isNull();
25 result.referrer_policy = blink::WebReferrerPolicyDefault; 26 result.referrer_policy = blink::WebReferrerPolicyDefault;
26 27
27 const WebVector<WebDragData::Item>& item_list = drag_data.items(); 28 const WebVector<WebDragData::Item>& item_list = drag_data.items();
28 for (size_t i = 0; i < item_list.size(); ++i) { 29 for (size_t i = 0; i < item_list.size(); ++i) {
29 const WebDragData::Item& item = item_list[i]; 30 const WebDragData::Item& item = item_list[i];
30 switch (item.storageType) { 31 switch (item.storageType) {
31 case WebDragData::Item::StorageTypeString: { 32 case WebDragData::Item::StorageTypeString: {
32 base::string16 str_type(item.stringType); 33 base::string16 str_type(item.stringType);
33 if (base::EqualsASCII(str_type, ui::Clipboard::kMimeTypeText)) { 34 if (base::EqualsASCII(str_type, ui::Clipboard::kMimeTypeText)) {
34 result.text = base::NullableString16(item.stringData, false); 35 result.text = base::NullableString16(item.stringData, false);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698