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

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) {
457 // Some sanity checks...
458 DCHECK(start_index != std::string::npos);
459 DCHECK(end_index != std::string::npos);
460 DCHECK((start_index - html_start) <= kuint32max);
461 DCHECK((end_index - html_start) <= kuint32max);
462 456
463 markup->assign(UTF8ToWide(cf_html.data() + html_start)); 457 // This might happen if the contents of the clipboard changed and CF_HTML is
464 *fragment_start = static_cast<uint32>(start_index - html_start); 458 // no longer available.
465 *fragment_end = static_cast<uint32>(end_index - html_start); 459 if (start_index == std::string::npos ||
466 } 460 end_index == std::string::npos ||
461 html_start == std::string::npos)
462 return;
463
464 DCHECK(start_index - html_start >= 0);
465 DCHECK(end_index - html_start >= 0);
466 DCHECK((start_index - html_start) <= kuint32max);
467 DCHECK((end_index - html_start) <= kuint32max);
468
469 markup->assign(UTF8ToWide(cf_html.data() + html_start));
470 *fragment_start = static_cast<uint32>(start_index - html_start);
471 *fragment_end = static_cast<uint32>(end_index - html_start);
467 } 472 }
468 473
469 SkBitmap Clipboard::ReadImage(Buffer buffer) const { 474 SkBitmap Clipboard::ReadImage(Buffer buffer) const {
470 DCHECK_EQ(buffer, BUFFER_STANDARD); 475 DCHECK_EQ(buffer, BUFFER_STANDARD);
471 476
472 // Acquire the clipboard. 477 // Acquire the clipboard.
473 ScopedClipboard clipboard; 478 ScopedClipboard clipboard;
474 if (!clipboard.Acquire(GetClipboardWindow())) 479 if (!clipboard.Acquire(GetClipboardWindow()))
475 return SkBitmap(); 480 return SkBitmap();
476 481
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 clipboard_owner_ = ::CreateWindow(L"ClipboardOwnerWindowClass", 736 clipboard_owner_ = ::CreateWindow(L"ClipboardOwnerWindowClass",
732 L"ClipboardOwnerWindow", 737 L"ClipboardOwnerWindow",
733 0, 0, 0, 0, 0, 738 0, 0, 0, 0, 0,
734 HWND_MESSAGE, 739 HWND_MESSAGE,
735 0, 0, 0); 740 0, 0, 0);
736 } 741 }
737 return clipboard_owner_; 742 return clipboard_owner_;
738 } 743 }
739 744
740 } // namespace ui 745 } // 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