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

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

Issue 6625075: Add stubs and glue for routing a request for an image from the clipboard. (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"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h"
18 #include "ui/base/clipboard/clipboard.h" 19 #include "ui/base/clipboard/clipboard.h"
19 #include "webkit/glue/scoped_clipboard_writer_glue.h" 20 #include "webkit/glue/scoped_clipboard_writer_glue.h"
20 #include "webkit/glue/webkit_glue.h" 21 #include "webkit/glue/webkit_glue.h"
21 22
22 #if WEBKIT_USING_CG 23 #if WEBKIT_USING_CG
23 #include "skia/ext/skia_utils_mac.h" 24 #include "skia/ext/skia_utils_mac.h"
24 #endif 25 #endif
25 26
26 using WebKit::WebClipboard; 27 using WebKit::WebClipboard;
28 using WebKit::WebData;
27 using WebKit::WebImage; 29 using WebKit::WebImage;
28 using WebKit::WebString; 30 using WebKit::WebString;
29 using WebKit::WebURL; 31 using WebKit::WebURL;
30 using WebKit::WebVector; 32 using WebKit::WebVector;
31 33
32 namespace webkit_glue { 34 namespace webkit_glue {
33 35
34 // Static 36 // Static
35 std::string WebClipboardImpl::URLToMarkup(const WebURL& url, 37 std::string WebClipboardImpl::URLToMarkup(const WebURL& url,
36 const WebString& title) { 38 const WebString& title) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 if (!ConvertBufferType(buffer, &buffer_type)) 119 if (!ConvertBufferType(buffer, &buffer_type))
118 return WebString(); 120 return WebString();
119 121
120 string16 html_stdstr; 122 string16 html_stdstr;
121 GURL gurl; 123 GURL gurl;
122 ClipboardReadHTML(buffer_type, &html_stdstr, &gurl); 124 ClipboardReadHTML(buffer_type, &html_stdstr, &gurl);
123 *source_url = gurl; 125 *source_url = gurl;
124 return html_stdstr; 126 return html_stdstr;
125 } 127 }
126 128
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
127 void WebClipboardImpl::writeHTML( 139 void WebClipboardImpl::writeHTML(
128 const WebString& html_text, const WebURL& source_url, 140 const WebString& html_text, const WebURL& source_url,
129 const WebString& plain_text, bool write_smart_paste) { 141 const WebString& plain_text, bool write_smart_paste) {
130 ScopedClipboardWriterGlue scw(ClipboardGetClipboard()); 142 ScopedClipboardWriterGlue scw(ClipboardGetClipboard());
131 scw.WriteHTML(html_text, source_url.spec()); 143 scw.WriteHTML(html_text, source_url.spec());
132 scw.WriteText(plain_text); 144 scw.WriteText(plain_text);
133 145
134 if (write_smart_paste) 146 if (write_smart_paste)
135 scw.WriteWebSmartPaste(); 147 scw.WriteWebSmartPaste();
136 } 148 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 break; 239 break;
228 #endif 240 #endif
229 default: 241 default:
230 NOTREACHED(); 242 NOTREACHED();
231 return false; 243 return false;
232 } 244 }
233 return true; 245 return true;
234 } 246 }
235 247
236 } // namespace webkit_glue 248 } // 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