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

Side by Side Diff: webkit/glue/webclipboard_impl.cc

Issue 8775025: Add glue for supporting custom MIME types in DataTransfer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | Annotate | Revision Log
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 #include "webkit/glue/webclipboard_impl.h" 5 #include "webkit/glue/webclipboard_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 WebData WebClipboardImpl::readImage(Buffer buffer) { 166 WebData WebClipboardImpl::readImage(Buffer buffer) {
167 ui::Clipboard::Buffer buffer_type; 167 ui::Clipboard::Buffer buffer_type;
168 if (!ConvertBufferType(buffer, &buffer_type)) 168 if (!ConvertBufferType(buffer, &buffer_type))
169 return WebData(); 169 return WebData();
170 170
171 std::string png_data; 171 std::string png_data;
172 client_->ReadImage(buffer_type, &png_data); 172 client_->ReadImage(buffer_type, &png_data);
173 return WebData(png_data); 173 return WebData(png_data);
174 } 174 }
175 175
176 WebString WebClipboardImpl::readCustomData(Buffer buffer,
177 const WebString& type) {
178 ui::Clipboard::Buffer buffer_type;
179 if (!ConvertBufferType(buffer, &buffer_type))
180 return WebString();
181
182 string16 data;
183 client_->ReadCustomData(buffer_type, type, &data);
184 return data;
185 }
186
176 void WebClipboardImpl::writeHTML( 187 void WebClipboardImpl::writeHTML(
177 const WebString& html_text, const WebURL& source_url, 188 const WebString& html_text, const WebURL& source_url,
178 const WebString& plain_text, bool write_smart_paste) { 189 const WebString& plain_text, bool write_smart_paste) {
179 ScopedClipboardWriterGlue scw(client_); 190 ScopedClipboardWriterGlue scw(client_);
180 scw.WriteHTML(html_text, source_url.spec()); 191 scw.WriteHTML(html_text, source_url.spec());
181 scw.WriteText(plain_text); 192 scw.WriteText(plain_text);
182 193
183 if (write_smart_paste) 194 if (write_smart_paste)
184 scw.WriteWebSmartPaste(); 195 scw.WriteWebSmartPaste();
185 } 196 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 break; 260 break;
250 #endif 261 #endif
251 default: 262 default:
252 NOTREACHED(); 263 NOTREACHED();
253 return false; 264 return false;
254 } 265 }
255 return true; 266 return true;
256 } 267 }
257 268
258 } // namespace webkit_glue 269 } // namespace webkit_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698