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

Side by Side Diff: webkit/glue/webdropdata_win.cc

Issue 10532168: Allow empty strings to be written to the clipboard (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment fix Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/webdropdata.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 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<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], string16()));
28 ui::ClipboardUtil::GetPlainText(data_object, &drop_data->plain_text); 28 string16 text;
29 std::string base_url; 29 ui::ClipboardUtil::GetPlainText(data_object, &text);
30 ui::ClipboardUtil::GetHtml(data_object, &drop_data->text_html, &base_url); 30 if (!text.empty()) {
31 if (!base_url.empty()) { 31 drop_data->text = NullableString16(text, false);
32 drop_data->html_base_url = GURL(base_url); 32 }
33 string16 html;
34 std::string html_base_url;
35 ui::ClipboardUtil::GetHtml(data_object, &html, &html_base_url);
36 if (!html.empty()) {
37 drop_data->html = NullableString16(html, false);
38 }
39 if (!html_base_url.empty()) {
40 drop_data->html_base_url = GURL(html_base_url);
33 } 41 }
34 ui::ClipboardUtil::GetWebCustomData(data_object, 42 ui::ClipboardUtil::GetWebCustomData(data_object,
35 &drop_data->custom_data); 43 &drop_data->custom_data);
36 } 44 }
OLDNEW
« no previous file with comments | « webkit/glue/webdropdata.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698