OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |