| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 | 92 |
| 93 // Called on GdkPixbuf destruction; see WriteBitmap(). | 93 // Called on GdkPixbuf destruction; see WriteBitmap(). |
| 94 void GdkPixbufFree(guchar* pixels, gpointer data) { | 94 void GdkPixbufFree(guchar* pixels, gpointer data) { |
| 95 free(pixels); | 95 free(pixels); |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace | 98 } // namespace |
| 99 | 99 |
| 100 Clipboard::Clipboard() : clipboard_data_(NULL) { | 100 Clipboard::Clipboard() : clipboard_data_(NULL) { |
| 101 #if !defined(USE_AURA) |
| 101 clipboard_ = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); | 102 clipboard_ = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); |
| 102 primary_selection_ = gtk_clipboard_get(GDK_SELECTION_PRIMARY); | 103 primary_selection_ = gtk_clipboard_get(GDK_SELECTION_PRIMARY); |
| 104 #endif |
| 103 } | 105 } |
| 104 | 106 |
| 105 Clipboard::~Clipboard() { | 107 Clipboard::~Clipboard() { |
| 106 gtk_clipboard_store(clipboard_); | 108 gtk_clipboard_store(clipboard_); |
| 107 } | 109 } |
| 108 | 110 |
| 109 void Clipboard::WriteObjects(const ObjectMap& objects) { | 111 void Clipboard::WriteObjects(const ObjectMap& objects) { |
| 110 clipboard_data_ = new TargetMap(); | 112 clipboard_data_ = new TargetMap(); |
| 111 | 113 |
| 112 for (ObjectMap::const_iterator iter = objects.begin(); | 114 for (ObjectMap::const_iterator iter = objects.begin(); |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 return clipboard_; | 458 return clipboard_; |
| 457 case BUFFER_SELECTION: | 459 case BUFFER_SELECTION: |
| 458 return primary_selection_; | 460 return primary_selection_; |
| 459 default: | 461 default: |
| 460 NOTREACHED(); | 462 NOTREACHED(); |
| 461 return NULL; | 463 return NULL; |
| 462 } | 464 } |
| 463 } | 465 } |
| 464 | 466 |
| 465 } // namespace ui | 467 } // namespace ui |
| OLD | NEW |