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

Side by Side Diff: ui/base/clipboard/clipboard_win.cc

Issue 8305012: Remove deprecated WebClipboard::readHTML method. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 2 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
« no previous file with comments | « no previous file | webkit/glue/webclipboard_impl.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Many of these functions are based on those found in 5 // Many of these functions are based on those found in
6 // webkit/port/platform/PasteboardWin.cpp 6 // webkit/port/platform/PasteboardWin.cpp
7 7
8 #include "ui/base/clipboard/clipboard.h" 8 #include "ui/base/clipboard/clipboard.h"
9 9
10 #include <shlobj.h> 10 #include <shlobj.h>
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 return; 446 return;
447 447
448 std::string cf_html(static_cast<const char*>(::GlobalLock(data))); 448 std::string cf_html(static_cast<const char*>(::GlobalLock(data)));
449 ::GlobalUnlock(data); 449 ::GlobalUnlock(data);
450 450
451 size_t html_start = std::string::npos; 451 size_t html_start = std::string::npos;
452 size_t start_index = std::string::npos; 452 size_t start_index = std::string::npos;
453 size_t end_index = std::string::npos; 453 size_t end_index = std::string::npos;
454 ClipboardUtil::CFHtmlExtractMetadata(cf_html, src_url, &html_start, 454 ClipboardUtil::CFHtmlExtractMetadata(cf_html, src_url, &html_start,
455 &start_index, &end_index); 455 &start_index, &end_index);
456 if (markup) { 456 // This might happen if the contents of the clipboard changed and CF_HTML is
457 // Some sanity checks... 457 // no longer available.
458 DCHECK(start_index != std::string::npos); 458 if (start_index == std::string::npos ||
459 DCHECK(end_index != std::string::npos); 459 end_index == std::string::npos ||
460 DCHECK((start_index - html_start) <= kuint32max); 460 html_start == std::string::npos)
461 DCHECK((end_index - html_start) <= kuint32max); 461 return;
462 462
463 markup->assign(UTF8ToWide(cf_html.data() + html_start)); 463 DCHECK((start_index - html_start) <= kuint32max);
464 *fragment_start = static_cast<uint32>(start_index - html_start); 464 DCHECK((end_index - html_start) <= kuint32max);
tony 2011/10/14 23:11:40 Do we also need to check that start_index - html_s
465 *fragment_end = static_cast<uint32>(end_index - html_start); 465
466 } 466 markup->assign(UTF8ToWide(cf_html.data() + html_start));
467 *fragment_start = static_cast<uint32>(start_index - html_start);
468 *fragment_end = static_cast<uint32>(end_index - html_start);
467 } 469 }
468 470
469 SkBitmap Clipboard::ReadImage(Buffer buffer) const { 471 SkBitmap Clipboard::ReadImage(Buffer buffer) const {
470 DCHECK_EQ(buffer, BUFFER_STANDARD); 472 DCHECK_EQ(buffer, BUFFER_STANDARD);
471 473
472 // Acquire the clipboard. 474 // Acquire the clipboard.
473 ScopedClipboard clipboard; 475 ScopedClipboard clipboard;
474 if (!clipboard.Acquire(GetClipboardWindow())) 476 if (!clipboard.Acquire(GetClipboardWindow()))
475 return SkBitmap(); 477 return SkBitmap();
476 478
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 clipboard_owner_ = ::CreateWindow(L"ClipboardOwnerWindowClass", 733 clipboard_owner_ = ::CreateWindow(L"ClipboardOwnerWindowClass",
732 L"ClipboardOwnerWindow", 734 L"ClipboardOwnerWindow",
733 0, 0, 0, 0, 0, 735 0, 0, 0, 0, 0,
734 HWND_MESSAGE, 736 HWND_MESSAGE,
735 0, 0, 0); 737 0, 0, 0);
736 } 738 }
737 return clipboard_owner_; 739 return clipboard_owner_;
738 } 740 }
739 741
740 } // namespace ui 742 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | webkit/glue/webclipboard_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698