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

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

Issue 6698011: Revert r78134+r78136 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 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 | « webkit/glue/webclipboard_impl.h ('k') | webkit/glue/webkit_glue.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) 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"
11 #include "net/base/escape.h" 11 #include "net/base/escape.h"
12 #include "third_party/skia/include/core/SkBitmap.h" 12 #include "third_party/skia/include/core/SkBitmap.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h"
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h"
19 #include "ui/base/clipboard/clipboard.h" 18 #include "ui/base/clipboard/clipboard.h"
20 #include "webkit/glue/scoped_clipboard_writer_glue.h" 19 #include "webkit/glue/scoped_clipboard_writer_glue.h"
21 #include "webkit/glue/webkit_glue.h" 20 #include "webkit/glue/webkit_glue.h"
22 21
23 #if WEBKIT_USING_CG 22 #if WEBKIT_USING_CG
24 #include "skia/ext/skia_utils_mac.h" 23 #include "skia/ext/skia_utils_mac.h"
25 #endif 24 #endif
26 25
27 using WebKit::WebClipboard; 26 using WebKit::WebClipboard;
28 using WebKit::WebData;
29 using WebKit::WebImage; 27 using WebKit::WebImage;
30 using WebKit::WebString; 28 using WebKit::WebString;
31 using WebKit::WebURL; 29 using WebKit::WebURL;
32 using WebKit::WebVector; 30 using WebKit::WebVector;
33 31
34 namespace webkit_glue { 32 namespace webkit_glue {
35 33
36 // Static 34 // Static
37 std::string WebClipboardImpl::URLToMarkup(const WebURL& url, 35 std::string WebClipboardImpl::URLToMarkup(const WebURL& url,
38 const WebString& title) { 36 const WebString& title) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 if (!ConvertBufferType(buffer, &buffer_type)) 117 if (!ConvertBufferType(buffer, &buffer_type))
120 return WebString(); 118 return WebString();
121 119
122 string16 html_stdstr; 120 string16 html_stdstr;
123 GURL gurl; 121 GURL gurl;
124 ClipboardReadHTML(buffer_type, &html_stdstr, &gurl); 122 ClipboardReadHTML(buffer_type, &html_stdstr, &gurl);
125 *source_url = gurl; 123 *source_url = gurl;
126 return html_stdstr; 124 return html_stdstr;
127 } 125 }
128 126
129 WebData WebClipboardImpl::readImage(Buffer buffer) {
130 ui::Clipboard::Buffer buffer_type;
131 if (!ConvertBufferType(buffer, &buffer_type))
132 return WebData();
133
134 std::string png_data;
135 ClipboardReadImage(buffer_type, &png_data);
136 return WebData(png_data);
137 }
138
139 void WebClipboardImpl::writeHTML( 127 void WebClipboardImpl::writeHTML(
140 const WebString& html_text, const WebURL& source_url, 128 const WebString& html_text, const WebURL& source_url,
141 const WebString& plain_text, bool write_smart_paste) { 129 const WebString& plain_text, bool write_smart_paste) {
142 ScopedClipboardWriterGlue scw(ClipboardGetClipboard()); 130 ScopedClipboardWriterGlue scw(ClipboardGetClipboard());
143 scw.WriteHTML(html_text, source_url.spec()); 131 scw.WriteHTML(html_text, source_url.spec());
144 scw.WriteText(plain_text); 132 scw.WriteText(plain_text);
145 133
146 if (write_smart_paste) 134 if (write_smart_paste)
147 scw.WriteWebSmartPaste(); 135 scw.WriteWebSmartPaste();
148 } 136 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 break; 227 break;
240 #endif 228 #endif
241 default: 229 default:
242 NOTREACHED(); 230 NOTREACHED();
243 return false; 231 return false;
244 } 232 }
245 return true; 233 return true;
246 } 234 }
247 235
248 } // namespace webkit_glue 236 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/glue/webclipboard_impl.h ('k') | webkit/glue/webkit_glue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698