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

Side by Side Diff: content/browser/web_contents/web_contents_drag_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 | « no previous file | content/browser/web_contents/web_contents_view_aura.cc » ('j') | 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 "content/browser/web_contents/web_contents_drag_win.h" 5 #include "content/browser/web_contents/web_contents_drag_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 PrepareDragForDownload(drop_data, &data, page_url, page_encoding); 275 PrepareDragForDownload(drop_data, &data, page_url, page_encoding);
276 276
277 // Set the observer. 277 // Set the observer.
278 ui::OSExchangeDataProviderWin::GetDataObjectImpl(data)->set_observer(this); 278 ui::OSExchangeDataProviderWin::GetDataObjectImpl(data)->set_observer(this);
279 } else { 279 } else {
280 // We set the file contents before the URL because the URL also sets file 280 // We set the file contents before the URL because the URL also sets file
281 // contents (to a .URL shortcut). We want to prefer file content data over 281 // contents (to a .URL shortcut). We want to prefer file content data over
282 // a shortcut so we add it first. 282 // a shortcut so we add it first.
283 if (!drop_data.file_contents.empty()) 283 if (!drop_data.file_contents.empty())
284 PrepareDragForFileContents(drop_data, &data); 284 PrepareDragForFileContents(drop_data, &data);
285 if (!drop_data.text_html.empty()) 285 if (!drop_data.html.string().empty())
286 data.SetHtml(drop_data.text_html, drop_data.html_base_url); 286 data.SetHtml(drop_data.html.string(), drop_data.html_base_url);
287 // We set the text contents before the URL because the URL also sets text 287 // We set the text contents before the URL because the URL also sets text
288 // content. 288 // content.
289 if (!drop_data.plain_text.empty()) 289 if (!drop_data.text.string().empty())
290 data.SetString(drop_data.plain_text); 290 data.SetString(drop_data.text.string());
291 if (drop_data.url.is_valid()) 291 if (drop_data.url.is_valid())
292 PrepareDragForUrl(drop_data, &data); 292 PrepareDragForUrl(drop_data, &data);
293 if (!drop_data.custom_data.empty()) { 293 if (!drop_data.custom_data.empty()) {
294 Pickle pickle; 294 Pickle pickle;
295 ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle); 295 ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle);
296 data.SetPickledData(ui::ClipboardUtil::GetWebCustomDataFormat()->cfFormat, 296 data.SetPickledData(ui::ClipboardUtil::GetWebCustomDataFormat()->cfFormat,
297 pickle); 297 pickle);
298 } 298 }
299 } 299 }
300 300
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 void WebContentsDragWin::OnDataObjectDisposed() { 366 void WebContentsDragWin::OnDataObjectDisposed() {
367 DCHECK(drag_drop_thread_id_ == base::PlatformThread::CurrentId()); 367 DCHECK(drag_drop_thread_id_ == base::PlatformThread::CurrentId());
368 368
369 // The drag-and-drop thread is only closed after OLE is done with 369 // The drag-and-drop thread is only closed after OLE is done with
370 // DataObjectImpl. 370 // DataObjectImpl.
371 BrowserThread::PostTask( 371 BrowserThread::PostTask(
372 BrowserThread::UI, 372 BrowserThread::UI,
373 FROM_HERE, 373 FROM_HERE,
374 base::Bind(&WebContentsDragWin::CloseThread, this)); 374 base::Bind(&WebContentsDragWin::CloseThread, this));
375 } 375 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_view_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698