OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/clipboard_util.h" | 7 #include "base/clipboard_util.h" |
8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
11 | 11 |
12 /* static */ | 12 /* static */ |
13 void WebDropData::PopulateWebDropData(IDataObject* data_object, | 13 void WebDropData::PopulateWebDropData(IDataObject* data_object, |
14 WebDropData* drop_data) { | 14 WebDropData* drop_data) { |
15 std::wstring url_str; | 15 std::wstring url_str; |
16 if (ClipboardUtil::GetUrl(data_object, &url_str, &drop_data->url_title)) { | 16 if (ClipboardUtil::GetUrl(data_object, &url_str, &drop_data->url_title)) { |
17 GURL test_url(url_str); | 17 GURL test_url(url_str); |
18 if (test_url.is_valid()) | 18 if (test_url.is_valid()) |
19 drop_data->url = test_url; | 19 drop_data->url = test_url; |
20 } | 20 } |
21 ClipboardUtil::GetFilenames(data_object, &drop_data->filenames); | 21 ClipboardUtil::GetFilenames(data_object, &drop_data->filenames); |
22 ClipboardUtil::GetPlainText(data_object, &drop_data->plain_text); | 22 ClipboardUtil::GetPlainText(data_object, &drop_data->plain_text); |
23 ClipboardUtil::GetCFHtml(data_object, &drop_data->cf_html); | 23 std::string base_url; |
24 ClipboardUtil::GetTextHtml(data_object, &drop_data->text_html); | 24 ClipboardUtil::GetHtml(data_object, &drop_data->text_html, &base_url); |
| 25 if (!base_url.empty()) { |
| 26 drop_data->html_base_url = GURL(base_url); |
| 27 } |
25 ClipboardUtil::GetFileContents(data_object, | 28 ClipboardUtil::GetFileContents(data_object, |
26 &drop_data->file_description_filename, &drop_data->file_contents); | 29 &drop_data->file_description_filename, &drop_data->file_contents); |
27 } | 30 } |
28 | 31 |
OLD | NEW |