1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "webkit/glue/webdropdata.h" 6 7 #include <windows.h> 8 #include <shellapi.h> 9 #include <shlobj.h> 10 11 #include "googleurl/src/gurl.h" 12 #include "ui/base/clipboard/clipboard_util_win.h" 13 14 // static 15 void WebDropData::PopulateWebDropData(IDataObject* data_object, 16 WebDropData* drop_data) { 17 std::wstring url_str; 18 if (ui::ClipboardUtil::GetUrl(data_object, &url_str, &drop_data->url_title, 19 false)) { 20 GURL test_url(url_str); 21 if (test_url.is_valid()) 22 drop_data->url = test_url; 23 } 24 ui::ClipboardUtil::GetFilenames(data_object, &drop_data->filenames); 25 ui::ClipboardUtil::GetPlainText(data_object, &drop_data->plain_text); 26 std::string base_url; 27 ui::ClipboardUtil::GetHtml(data_object, &drop_data->text_html, &base_url); 28 if (!base_url.empty()) { 29 drop_data->html_base_url = GURL(base_url); 30 } 31 ui::ClipboardUtil::GetFileContents(data_object, 32 &drop_data->file_description_filename, &drop_data->file_contents); 33 } 34