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

Side by Side Diff: content/renderer/webclipboard_impl.cc

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
« no previous file with comments | « content/renderer/webclipboard_impl.h ('k') | content/renderer/webclipboard_impl_browsertest.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/renderer/webclipboard_impl.h" 5 #include "content/renderer/webclipboard_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 base::string16 html_stdstr; 103 base::string16 html_stdstr;
104 GURL gurl; 104 GURL gurl;
105 delegate_->ReadHTML(clipboard_type, &html_stdstr, &gurl, 105 delegate_->ReadHTML(clipboard_type, &html_stdstr, &gurl,
106 static_cast<uint32_t*>(fragment_start), 106 static_cast<uint32_t*>(fragment_start),
107 static_cast<uint32_t*>(fragment_end)); 107 static_cast<uint32_t*>(fragment_end));
108 *source_url = gurl; 108 *source_url = gurl;
109 return html_stdstr; 109 return html_stdstr;
110 } 110 }
111 111
112 WebString WebClipboardImpl::readRTF(Buffer buffer) {
113 ui::ClipboardType clipboard_type;
114 if (!ConvertBufferType(buffer, &clipboard_type))
115 return WebString();
116
117 std::string rtf;
118 delegate_->ReadRTF(clipboard_type, &rtf);
119 return WebString::fromLatin1(rtf);
120 }
121
112 WebBlobInfo WebClipboardImpl::readImage(Buffer buffer) { 122 WebBlobInfo WebClipboardImpl::readImage(Buffer buffer) {
113 ui::ClipboardType clipboard_type; 123 ui::ClipboardType clipboard_type;
114 if (!ConvertBufferType(buffer, &clipboard_type)) 124 if (!ConvertBufferType(buffer, &clipboard_type))
115 return WebBlobInfo(); 125 return WebBlobInfo();
116 126
117 std::string blob_uuid; 127 std::string blob_uuid;
118 std::string type; 128 std::string type;
119 int64_t size; 129 int64_t size;
120 delegate_->ReadImage(clipboard_type, &blob_uuid, &type, &size); 130 delegate_->ReadImage(clipboard_type, &blob_uuid, &type, &size);
121 if (size < 0) 131 if (size < 0)
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 return false; 222 return false;
213 #endif 223 #endif
214 default: 224 default:
215 NOTREACHED(); 225 NOTREACHED();
216 return false; 226 return false;
217 } 227 }
218 return true; 228 return true;
219 } 229 }
220 230
221 } // namespace content 231 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/webclipboard_impl.h ('k') | content/renderer/webclipboard_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698