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

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

Issue 18281002: Move WebDropData to content::DropData and split off conversion function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Mac build error. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/test/test_web_contents_view.h » ('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/pickle.h" 8 #include "base/pickle.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "content/public/common/drop_data.h"
12 #include "content/renderer/drop_data_builder.h"
11 #include "content/renderer/scoped_clipboard_writer_glue.h" 13 #include "content/renderer/scoped_clipboard_writer_glue.h"
12 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
13 #include "third_party/WebKit/public/platform/WebData.h" 15 #include "third_party/WebKit/public/platform/WebData.h"
14 #include "third_party/WebKit/public/platform/WebDragData.h" 16 #include "third_party/WebKit/public/platform/WebDragData.h"
15 #include "third_party/WebKit/public/platform/WebImage.h" 17 #include "third_party/WebKit/public/platform/WebImage.h"
16 #include "third_party/WebKit/public/platform/WebSize.h" 18 #include "third_party/WebKit/public/platform/WebSize.h"
17 #include "third_party/WebKit/public/platform/WebString.h" 19 #include "third_party/WebKit/public/platform/WebString.h"
18 #include "third_party/WebKit/public/platform/WebURL.h" 20 #include "third_party/WebKit/public/platform/WebURL.h"
19 #include "third_party/WebKit/public/platform/WebVector.h" 21 #include "third_party/WebKit/public/platform/WebVector.h"
20 #include "third_party/skia/include/core/SkBitmap.h" 22 #include "third_party/skia/include/core/SkBitmap.h"
21 #include "ui/base/clipboard/clipboard.h" 23 #include "ui/base/clipboard/clipboard.h"
22 #include "ui/base/clipboard/custom_data_helper.h" 24 #include "ui/base/clipboard/custom_data_helper.h"
23 #include "webkit/common/webdropdata.h"
24 #include "webkit/glue/webkit_glue.h" 25 #include "webkit/glue/webkit_glue.h"
25 #include "webkit/renderer/clipboard_utils.h" 26 #include "webkit/renderer/clipboard_utils.h"
26 27
27 using WebKit::WebClipboard; 28 using WebKit::WebClipboard;
28 using WebKit::WebData; 29 using WebKit::WebData;
29 using WebKit::WebDragData; 30 using WebKit::WebDragData;
30 using WebKit::WebImage; 31 using WebKit::WebImage;
31 using WebKit::WebString; 32 using WebKit::WebString;
32 using WebKit::WebURL; 33 using WebKit::WebURL;
33 using WebKit::WebVector; 34 using WebKit::WebVector;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // http://crbug.com/33016 for details. 202 // http://crbug.com/33016 for details.
202 scw.WriteHTML(UTF8ToUTF16(webkit_clipboard::URLToImageMarkup(url, title)), 203 scw.WriteHTML(UTF8ToUTF16(webkit_clipboard::URLToImageMarkup(url, title)),
203 std::string()); 204 std::string());
204 #endif 205 #endif
205 } 206 }
206 } 207 }
207 208
208 void WebClipboardImpl::writeDataObject(const WebDragData& data) { 209 void WebClipboardImpl::writeDataObject(const WebDragData& data) {
209 ScopedClipboardWriterGlue scw(client_); 210 ScopedClipboardWriterGlue scw(client_);
210 211
211 WebDropData data_object(data); 212 const DropData& data_object = DropDataBuilder::Build(data);
212 // TODO(dcheng): Properly support text/uri-list here. 213 // TODO(dcheng): Properly support text/uri-list here.
213 if (!data_object.text.is_null()) 214 if (!data_object.text.is_null())
214 scw.WriteText(data_object.text.string()); 215 scw.WriteText(data_object.text.string());
215 if (!data_object.html.is_null()) 216 if (!data_object.html.is_null())
216 scw.WriteHTML(data_object.html.string(), std::string()); 217 scw.WriteHTML(data_object.html.string(), std::string());
217 // If there is no custom data, avoid calling WritePickledData. This ensures 218 // If there is no custom data, avoid calling WritePickledData. This ensures
218 // that ScopedClipboardWriterGlue's dtor remains a no-op if the page didn't 219 // that ScopedClipboardWriterGlue's dtor remains a no-op if the page didn't
219 // modify the DataTransfer object, which is important to avoid stomping on 220 // modify the DataTransfer object, which is important to avoid stomping on
220 // any clipboard contents written by extension functions such as 221 // any clipboard contents written by extension functions such as
221 // chrome.bookmarkManagerPrivate.copy. 222 // chrome.bookmarkManagerPrivate.copy.
(...skipping 23 matching lines...) Expand all
245 #endif 246 #endif
246 default: 247 default:
247 NOTREACHED(); 248 NOTREACHED();
248 return false; 249 return false;
249 } 250 }
250 return true; 251 return true;
251 } 252 }
252 253
253 } // namespace content 254 } // namespace content
254 255
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/test/test_web_contents_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698