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

Unified Diff: content/renderer/drop_data_builder.cc

Issue 18281002: Move WebDropData to content::DropData and split off conversion function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Mac build error. Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/drop_data_builder.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/drop_data_builder.cc
diff --git a/webkit/common/webdropdata.cc b/content/renderer/drop_data_builder.cc
similarity index 50%
rename from webkit/common/webdropdata.cc
rename to content/renderer/drop_data_builder.cc
index aee885ae828890a7ebae686d875d506b596c5e18..56bc81a9964e2679eeb151012cf53063dbe366d1 100644
--- a/webkit/common/webdropdata.cc
+++ b/content/renderer/drop_data_builder.cc
@@ -2,79 +2,66 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "webkit/common/webdropdata.h"
+#include "content/renderer/drop_data_builder.h"
-#include <utility>
-
-#include "base/logging.h"
#include "base/strings/string_util.h"
-#include "base/strings/utf_string_conversions.h"
-#include "third_party/WebKit/public/platform/WebData.h"
+#include "content/public/common/drop_data.h"
#include "third_party/WebKit/public/platform/WebDragData.h"
#include "third_party/WebKit/public/platform/WebString.h"
-#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/platform/WebVector.h"
#include "ui/base/clipboard/clipboard.h"
-using WebKit::WebData;
using WebKit::WebDragData;
-using WebKit::WebString;
using WebKit::WebVector;
-WebDropData::FileInfo::FileInfo() {
-}
+namespace content {
-WebDropData::FileInfo::FileInfo(const base::string16& path,
- const base::string16& display_name)
- : path(path),
- display_name(display_name) {
-}
+//static
+DropData DropDataBuilder::Build(const WebDragData& drag_data) {
+ DropData result;
+ result.referrer_policy = WebKit::WebReferrerPolicyDefault;
-WebDropData::WebDropData(const WebDragData& drag_data)
- : referrer_policy(WebKit::WebReferrerPolicyDefault) {
const WebVector<WebDragData::Item>& item_list = drag_data.items();
for (size_t i = 0; i < item_list.size(); ++i) {
const WebDragData::Item& item = item_list[i];
switch (item.storageType) {
case WebDragData::Item::StorageTypeString: {
if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeText)) {
- text = base::NullableString16(item.stringData, false);
+ result.text = base::NullableString16(item.stringData, false);
break;
}
if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeURIList)) {
- url = GURL(item.stringData);
- url_title = item.title;
+ result.url = GURL(item.stringData);
+ result.url_title = item.title;
break;
}
if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeDownloadURL)) {
- download_metadata = item.stringData;
+ result.download_metadata = item.stringData;
break;
}
if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeHTML)) {
- html = base::NullableString16(item.stringData, false);
- html_base_url = item.baseURL;
+ result.html = base::NullableString16(item.stringData, false);
+ result.html_base_url = item.baseURL;
break;
}
- custom_data.insert(std::make_pair(item.stringType, item.stringData));
+ result.custom_data.insert(
+ std::make_pair(item.stringType, item.stringData));
break;
}
case WebDragData::Item::StorageTypeBinaryData:
- file_contents.assign(item.binaryData.data(),
- item.binaryData.size());
- file_description_filename = item.title;
+ result.file_contents.assign(item.binaryData.data(),
+ item.binaryData.size());
+ result.file_description_filename = item.title;
break;
case WebDragData::Item::StorageTypeFilename:
// TODO(varunjain): This only works on chromeos. Support win/mac/gtk.
- filenames.push_back(FileInfo(item.filenameData,
- item.displayNameData));
+ result.filenames.push_back(
+ DropData::FileInfo(item.filenameData, item.displayNameData));
break;
}
}
-}
-WebDropData::WebDropData()
- : referrer_policy(WebKit::WebReferrerPolicyDefault) {
+ return result;
}
-WebDropData::~WebDropData() {
-}
+} // namespace content
« no previous file with comments | « content/renderer/drop_data_builder.h ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698