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

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

Issue 8805030: Revert 113040 - Enable custom MIME types in web copy/paste. (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
« no previous file with comments | « ui/base/clipboard/clipboard_win.cc ('k') | no next file » | 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 #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/pickle.h"
9 #include "base/string_util.h" 8 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
11 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
12 #include "net/base/escape.h" 11 #include "net/base/escape.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebData.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebDragData. h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebDragData. h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebImage.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebImage.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
21 #include "ui/base/clipboard/clipboard.h" 20 #include "ui/base/clipboard/clipboard.h"
22 #include "ui/base/clipboard/custom_data_helper.h"
23 #include "webkit/glue/scoped_clipboard_writer_glue.h" 21 #include "webkit/glue/scoped_clipboard_writer_glue.h"
24 #include "webkit/glue/webdropdata.h"
25 #include "webkit/glue/webkit_glue.h" 22 #include "webkit/glue/webkit_glue.h"
26 23
27 #if WEBKIT_USING_CG 24 #if WEBKIT_USING_CG
28 #include "skia/ext/skia_utils_mac.h" 25 #include "skia/ext/skia_utils_mac.h"
29 #endif 26 #endif
30 27
31 using WebKit::WebClipboard; 28 using WebKit::WebClipboard;
32 using WebKit::WebData; 29 using WebKit::WebData;
33 using WebKit::WebDragData; 30 using WebKit::WebDragData;
34 using WebKit::WebImage; 31 using WebKit::WebImage;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 #endif 236 #endif
240 } 237 }
241 } 238 }
242 239
243 void WebClipboardImpl::writeDataObject(const WebDragData& data) { 240 void WebClipboardImpl::writeDataObject(const WebDragData& data) {
244 // TODO(dcheng): This actually results in a double clear of the clipboard. 241 // TODO(dcheng): This actually results in a double clear of the clipboard.
245 // Once in WebKit, and once here when the clipboard writer goes out of scope. 242 // Once in WebKit, and once here when the clipboard writer goes out of scope.
246 // The same is true of the other WebClipboard::write* methods. 243 // The same is true of the other WebClipboard::write* methods.
247 ScopedClipboardWriterGlue scw(client_); 244 ScopedClipboardWriterGlue scw(client_);
248 245
249 WebDropData data_object(data);
250 // TODO(dcheng): Properly support text/uri-list here. 246 // TODO(dcheng): Properly support text/uri-list here.
251 scw.WriteText(data_object.plain_text); 247 scw.WriteText(data.plainText());
252 scw.WriteHTML(data_object.text_html, ""); 248 scw.WriteHTML(data.htmlText(), "");
253 Pickle pickle;
254 ui::WriteCustomDataToPickle(data_object.custom_data, &pickle);
255 scw.WritePickledData(pickle, ui::Clipboard::GetWebCustomDataFormatType());
256 } 249 }
257 250
258 bool WebClipboardImpl::ConvertBufferType(Buffer buffer, 251 bool WebClipboardImpl::ConvertBufferType(Buffer buffer,
259 ui::Clipboard::Buffer* result) { 252 ui::Clipboard::Buffer* result) {
260 switch (buffer) { 253 switch (buffer) {
261 case BufferStandard: 254 case BufferStandard:
262 *result = ui::Clipboard::BUFFER_STANDARD; 255 *result = ui::Clipboard::BUFFER_STANDARD;
263 break; 256 break;
264 case BufferSelection: 257 case BufferSelection:
265 #if defined(USE_X11) && !defined(USE_AURA) 258 #if defined(USE_X11) && !defined(USE_AURA)
266 *result = ui::Clipboard::BUFFER_SELECTION; 259 *result = ui::Clipboard::BUFFER_SELECTION;
267 break; 260 break;
268 #endif 261 #endif
269 default: 262 default:
270 NOTREACHED(); 263 NOTREACHED();
271 return false; 264 return false;
272 } 265 }
273 return true; 266 return true;
274 } 267 }
275 268
276 } // namespace webkit_glue 269 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « ui/base/clipboard/clipboard_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698