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

Side by Side Diff: third_party/WebKit/Source/core/clipboard/DataObjectItem.cpp

Issue 2146323002: Expose RTF content on the clipboard as strings to pages when pasting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: BrowserTestClipboardScope. Created 4 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 if (m_source == InternalSource) 132 if (m_source == InternalSource)
133 return m_data; 133 return m_data;
134 134
135 ASSERT(m_source == PasteboardSource); 135 ASSERT(m_source == PasteboardSource);
136 136
137 WebClipboard::Buffer buffer = Pasteboard::generalPasteboard()->buffer(); 137 WebClipboard::Buffer buffer = Pasteboard::generalPasteboard()->buffer();
138 String data; 138 String data;
139 // This is ugly but there's no real alternative. 139 // This is ugly but there's no real alternative.
140 if (m_type == mimeTypeTextPlain) { 140 if (m_type == mimeTypeTextPlain) {
141 data = Platform::current()->clipboard()->readPlainText(buffer); 141 data = Platform::current()->clipboard()->readPlainText(buffer);
142 } else if (m_type == mimeTypeTextRTF) {
143 data = Platform::current()->clipboard()->readRTF(buffer);
142 } else if (m_type == mimeTypeTextHTML) { 144 } else if (m_type == mimeTypeTextHTML) {
143 WebURL ignoredSourceURL; 145 WebURL ignoredSourceURL;
144 unsigned ignored; 146 unsigned ignored;
145 data = Platform::current()->clipboard()->readHTML(buffer, &ignoredSource URL, &ignored, &ignored); 147 data = Platform::current()->clipboard()->readHTML(buffer, &ignoredSource URL, &ignored, &ignored);
146 } else { 148 } else {
147 data = Platform::current()->clipboard()->readCustomData(buffer, m_type); 149 data = Platform::current()->clipboard()->readCustomData(buffer, m_type);
148 } 150 }
149 151
150 return Platform::current()->clipboard()->sequenceNumber(buffer) == m_sequenc eNumber ? data : String(); 152 return Platform::current()->clipboard()->sequenceNumber(buffer) == m_sequenc eNumber ? data : String();
151 } 153 }
152 154
153 bool DataObjectItem::isFilename() const 155 bool DataObjectItem::isFilename() const
154 { 156 {
155 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=81261: When we properly su pport File dragout, 157 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=81261: When we properly su pport File dragout,
156 // we'll need to make sure this works as expected for DragDataChromium. 158 // we'll need to make sure this works as expected for DragDataChromium.
157 return m_kind == FileKind && m_file; 159 return m_kind == FileKind && m_file;
158 } 160 }
159 161
160 DEFINE_TRACE(DataObjectItem) 162 DEFINE_TRACE(DataObjectItem)
161 { 163 {
162 visitor->trace(m_file); 164 visitor->trace(m_file);
163 } 165 }
164 166
165 } // namespace blink 167 } // namespace blink
OLDNEW
« no previous file with comments | « content/test/data/paste_listener.html ('k') | third_party/WebKit/Source/platform/clipboard/ClipboardMimeTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698