| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/glue/webdropdata.h" | 5 #include "webkit/glue/webdropdata.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 #include <shlobj.h> | 9 #include <shlobj.h> |
| 10 | 10 |
| 11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| 12 #include "ui/base/clipboard/clipboard_util_win.h" | 12 #include "ui/base/clipboard/clipboard_util_win.h" |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 void WebDropData::PopulateWebDropData(IDataObject* data_object, | 15 void WebDropData::PopulateWebDropData(IDataObject* data_object, |
| 16 WebDropData* drop_data) { | 16 WebDropData* drop_data) { |
| 17 string16 url_str; | 17 base::string16 url_str; |
| 18 if (ui::ClipboardUtil::GetUrl(data_object, &url_str, &drop_data->url_title, | 18 if (ui::ClipboardUtil::GetUrl(data_object, &url_str, &drop_data->url_title, |
| 19 false)) { | 19 false)) { |
| 20 GURL test_url(url_str); | 20 GURL test_url(url_str); |
| 21 if (test_url.is_valid()) | 21 if (test_url.is_valid()) |
| 22 drop_data->url = test_url; | 22 drop_data->url = test_url; |
| 23 } | 23 } |
| 24 std::vector<string16> filenames; | 24 std::vector<base::string16> filenames; |
| 25 ui::ClipboardUtil::GetFilenames(data_object, &filenames); | 25 ui::ClipboardUtil::GetFilenames(data_object, &filenames); |
| 26 for (size_t i = 0; i < filenames.size(); ++i) | 26 for (size_t i = 0; i < filenames.size(); ++i) |
| 27 drop_data->filenames.push_back(FileInfo(filenames[i], string16())); | 27 drop_data->filenames.push_back(FileInfo(filenames[i], base::string16())); |
| 28 string16 text; | 28 base::string16 text; |
| 29 ui::ClipboardUtil::GetPlainText(data_object, &text); | 29 ui::ClipboardUtil::GetPlainText(data_object, &text); |
| 30 if (!text.empty()) { | 30 if (!text.empty()) { |
| 31 drop_data->text = NullableString16(text, false); | 31 drop_data->text = NullableString16(text, false); |
| 32 } | 32 } |
| 33 string16 html; | 33 base::string16 html; |
| 34 std::string html_base_url; | 34 std::string html_base_url; |
| 35 ui::ClipboardUtil::GetHtml(data_object, &html, &html_base_url); | 35 ui::ClipboardUtil::GetHtml(data_object, &html, &html_base_url); |
| 36 if (!html.empty()) { | 36 if (!html.empty()) { |
| 37 drop_data->html = NullableString16(html, false); | 37 drop_data->html = NullableString16(html, false); |
| 38 } | 38 } |
| 39 if (!html_base_url.empty()) { | 39 if (!html_base_url.empty()) { |
| 40 drop_data->html_base_url = GURL(html_base_url); | 40 drop_data->html_base_url = GURL(html_base_url); |
| 41 } | 41 } |
| 42 ui::ClipboardUtil::GetWebCustomData(data_object, | 42 ui::ClipboardUtil::GetWebCustomData(data_object, |
| 43 &drop_data->custom_data); | 43 &drop_data->custom_data); |
| 44 } | 44 } |
| OLD | NEW |