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

Side by Side Diff: ui/base/clipboard/clipboard_gtk.cc

Issue 11225021: Move flash clipboard to the new proxy and add custom format support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month 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 | « ui/base/clipboard/clipboard_chromeos.cc ('k') | ui/base/clipboard/clipboard_mac.mm » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <X11/extensions/Xfixes.h> 8 #include <X11/extensions/Xfixes.h>
9 #include <X11/Xatom.h> 9 #include <X11/Xatom.h>
10 #include <map> 10 #include <map>
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 primary_sequence_number_++; 101 primary_sequence_number_++;
102 } else { 102 } else {
103 DLOG(ERROR) << "Unexpected selection atom: " << ev->selection; 103 DLOG(ERROR) << "Unexpected selection atom: " << ev->selection;
104 } 104 }
105 } 105 }
106 return GDK_FILTER_CONTINUE; 106 return GDK_FILTER_CONTINUE;
107 } 107 }
108 108
109 const char kMimeTypeBitmap[] = "image/bmp"; 109 const char kMimeTypeBitmap[] = "image/bmp";
110 const char kMimeTypeMozillaURL[] = "text/x-moz-url"; 110 const char kMimeTypeMozillaURL[] = "text/x-moz-url";
111 const char kMimeTypePepperCustomData[] = "chromium/x-pepper-custom-data";
111 const char kMimeTypeWebkitSmartPaste[] = "chromium/x-webkit-paste"; 112 const char kMimeTypeWebkitSmartPaste[] = "chromium/x-webkit-paste";
112 113
113 std::string GdkAtomToString(const GdkAtom& atom) { 114 std::string GdkAtomToString(const GdkAtom& atom) {
114 gchar* name = gdk_atom_name(atom); 115 gchar* name = gdk_atom_name(atom);
115 std::string rv(name); 116 std::string rv(name);
116 g_free(name); 117 g_free(name);
117 return rv; 118 return rv;
118 } 119 }
119 120
120 GdkAtom StringToGdkAtom(const std::string& str) { 121 GdkAtom StringToGdkAtom(const std::string& str) {
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeWebkitSmartPaste)); 644 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeWebkitSmartPaste));
644 return type; 645 return type;
645 } 646 }
646 647
647 // static 648 // static
648 const Clipboard::FormatType& Clipboard::GetWebCustomDataFormatType() { 649 const Clipboard::FormatType& Clipboard::GetWebCustomDataFormatType() {
649 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeWebCustomData)); 650 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypeWebCustomData));
650 return type; 651 return type;
651 } 652 }
652 653
654 // static
655 const Clipboard::FormatType& Clipboard::GetPepperCustomDataFormatType() {
656 CR_DEFINE_STATIC_LOCAL(FormatType, type, (kMimeTypePepperCustomData));
657 return type;
658 }
659
653 void Clipboard::InsertMapping(const char* key, 660 void Clipboard::InsertMapping(const char* key,
654 char* data, 661 char* data,
655 size_t data_len) { 662 size_t data_len) {
656 DCHECK(clipboard_data_->find(key) == clipboard_data_->end()); 663 DCHECK(clipboard_data_->find(key) == clipboard_data_->end());
657 (*clipboard_data_)[key] = std::make_pair(data, data_len); 664 (*clipboard_data_)[key] = std::make_pair(data, data_len);
658 } 665 }
659 666
660 GtkClipboard* Clipboard::LookupBackingClipboard(Buffer clipboard) const { 667 GtkClipboard* Clipboard::LookupBackingClipboard(Buffer clipboard) const {
661 switch (clipboard) { 668 switch (clipboard) {
662 case BUFFER_STANDARD: 669 case BUFFER_STANDARD:
663 return clipboard_; 670 return clipboard_;
664 case BUFFER_SELECTION: 671 case BUFFER_SELECTION:
665 return primary_selection_; 672 return primary_selection_;
666 default: 673 default:
667 NOTREACHED(); 674 NOTREACHED();
668 return NULL; 675 return NULL;
669 } 676 }
670 } 677 }
671 678
672 } // namespace ui 679 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/clipboard/clipboard_chromeos.cc ('k') | ui/base/clipboard/clipboard_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698