OLD | NEW |
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 "ui/base/clipboard/clipboard.h" | 5 #include "ui/base/clipboard/clipboard.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 | 381 |
382 SkBitmap Clipboard::ReadImage(Buffer buffer) const { | 382 SkBitmap Clipboard::ReadImage(Buffer buffer) const { |
383 ScopedGObject<GdkPixbuf>::Type pixbuf( | 383 ScopedGObject<GdkPixbuf>::Type pixbuf( |
384 gtk_clipboard_wait_for_image(clipboard_)); | 384 gtk_clipboard_wait_for_image(clipboard_)); |
385 if (!pixbuf.get()) | 385 if (!pixbuf.get()) |
386 return SkBitmap(); | 386 return SkBitmap(); |
387 | 387 |
388 gfx::CanvasSkia canvas(gdk_pixbuf_get_width(pixbuf.get()), | 388 gfx::CanvasSkia canvas(gdk_pixbuf_get_width(pixbuf.get()), |
389 gdk_pixbuf_get_height(pixbuf.get()), | 389 gdk_pixbuf_get_height(pixbuf.get()), |
390 false); | 390 false); |
391 skia::ScopedPlatformPaint scoped_platform_paint(&canvas); | 391 { |
392 cairo_t* context = scoped_platform_paint.GetPlatformSurface(); | 392 skia::ScopedPlatformPaint scoped_platform_paint(&canvas); |
393 gdk_cairo_set_source_pixbuf(context, pixbuf.get(), 0.0, 0.0); | 393 cairo_t* context = scoped_platform_paint.GetPlatformSurface(); |
394 cairo_paint(context); | 394 gdk_cairo_set_source_pixbuf(context, pixbuf.get(), 0.0, 0.0); |
| 395 cairo_paint(context); |
| 396 } |
395 return canvas.ExtractBitmap(); | 397 return canvas.ExtractBitmap(); |
396 } | 398 } |
397 | 399 |
398 void Clipboard::ReadBookmark(string16* title, std::string* url) const { | 400 void Clipboard::ReadBookmark(string16* title, std::string* url) const { |
399 // TODO(estade): implement this. | 401 // TODO(estade): implement this. |
400 NOTIMPLEMENTED(); | 402 NOTIMPLEMENTED(); |
401 } | 403 } |
402 | 404 |
403 void Clipboard::ReadData(const std::string& format, std::string* result) { | 405 void Clipboard::ReadData(const std::string& format, std::string* result) { |
404 GtkSelectionData* data = | 406 GtkSelectionData* data = |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 return clipboard_; | 456 return clipboard_; |
455 case BUFFER_SELECTION: | 457 case BUFFER_SELECTION: |
456 return primary_selection_; | 458 return primary_selection_; |
457 default: | 459 default: |
458 NOTREACHED(); | 460 NOTREACHED(); |
459 return NULL; | 461 return NULL; |
460 } | 462 } |
461 } | 463 } |
462 | 464 |
463 } // namespace ui | 465 } // namespace ui |
OLD | NEW |