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

Unified Diff: ui/base/clipboard/clipboard_gtk.cc

Issue 12298037: Revert 183123 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1417/src/
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/clipboard/clipboard_chromeos.cc ('k') | ui/base/clipboard/clipboard_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/clipboard/clipboard_gtk.cc
===================================================================
--- ui/base/clipboard/clipboard_gtk.cc (revision 183210)
+++ ui/base/clipboard/clipboard_gtk.cc (working copy)
@@ -106,7 +106,6 @@
return GDK_FILTER_CONTINUE;
}
-const char kSourceTagType[] = "org.chromium.source-tag";
const char kMimeTypeBitmap[] = "image/bmp";
const char kMimeTypeMozillaURL[] = "text/x-moz-url";
const char kMimeTypePepperCustomData[] = "chromium/x-pepper-custom-data";
@@ -153,7 +152,7 @@
// GtkClipboardClearFunc callback.
// We are guaranteed this will be called exactly once for each call to
// gtk_clipboard_set_with_data.
-void ClearData(GtkClipboard* /*clipboard*/,
+void ClearData(GtkClipboard* clipboard,
gpointer user_data) {
Clipboard::TargetMap* map =
reinterpret_cast<Clipboard::TargetMap*>(user_data);
@@ -218,9 +217,7 @@
gtk_clipboard_store(clipboard_);
}
-void Clipboard::WriteObjectsImpl(Buffer buffer,
- const ObjectMap& objects,
- SourceTag tag) {
+void Clipboard::WriteObjects(Buffer buffer, const ObjectMap& objects) {
DCHECK(CalledOnValidThread());
clipboard_data_ = new TargetMap();
@@ -228,24 +225,13 @@
iter != objects.end(); ++iter) {
DispatchObject(static_cast<ObjectType>(iter->first), iter->second);
}
- WriteSourceTag(tag);
- SetGtkClipboard(buffer);
- if (buffer == BUFFER_STANDARD) {
- ObjectMap::const_iterator text_iter = objects.find(CBF_TEXT);
- if (text_iter != objects.end()) {
- // Copy text and SourceTag to the selection clipboard.
- ObjectMap::const_iterator next_iter = text_iter;
- WriteObjectsImpl(BUFFER_SELECTION,
- ObjectMap(text_iter, ++next_iter),
- tag);
- }
- }
+ SetGtkClipboard(buffer);
}
// Take ownership of the GTK clipboard and inform it of the targets we support.
void Clipboard::SetGtkClipboard(Buffer buffer) {
- scoped_array<GtkTargetEntry> targets(
+ scoped_ptr<GtkTargetEntry[]> targets(
new GtkTargetEntry[clipboard_data_->size()]);
int i = 0;
@@ -267,6 +253,14 @@
clipboard_data_->size());
}
+ if (buffer == BUFFER_STANDARD) {
+ Clipboard::TargetMap::iterator text_iter = clipboard_data_->find("TEXT");
+ if (text_iter != clipboard_data_->end()) {
+ gtk_clipboard_set_text(primary_selection_, text_iter->second.first,
+ text_iter->second.second);
+ }
+ }
+
// clipboard_data_ now owned by the GtkClipboard.
clipboard_data_ = NULL;
}
@@ -356,13 +350,6 @@
InsertMapping(GdkAtomToString(format.ToGdkAtom()).c_str(), data, data_len);
}
-void Clipboard::WriteSourceTag(SourceTag tag) {
- if (tag != SourceTag()) {
- ObjectMapParam binary = SourceTag2Binary(tag);
- WriteData(GetSourceTagFormatType(), &binary[0], binary.size());
- }
-}
-
// We do not use gtk_clipboard_wait_is_target_available because of
// a bug with the gtk clipboard. It caches the available targets
// and does not always refresh the cache when it is appropriate.
@@ -589,17 +576,9 @@
}
void Clipboard::ReadData(const FormatType& format, std::string* result) const {
- ReadDataImpl(BUFFER_STANDARD, format, result);
-}
-
-void Clipboard::ReadDataImpl(Buffer buffer,
- const FormatType& format,
- std::string* result) const {
DCHECK(CalledOnValidThread());
- result->clear();
- GtkClipboard* clipboard = LookupBackingClipboard(buffer);
GtkSelectionData* data =
- gtk_clipboard_wait_for_contents(clipboard, format.ToGdkAtom());
+ gtk_clipboard_wait_for_contents(clipboard_, format.ToGdkAtom());
if (!data)
return;
result->assign(reinterpret_cast<const char*>(
@@ -608,12 +587,6 @@
gtk_selection_data_free(data);
}
-Clipboard::SourceTag Clipboard::ReadSourceTag(Buffer buffer) const {
- std::string result;
- ReadDataImpl(buffer, GetSourceTagFormatType(), &result);
- return Binary2SourceTag(result);
-}
-
uint64 Clipboard::GetSequenceNumber(Buffer buffer) {
DCHECK(CalledOnValidThread());
if (buffer == BUFFER_STANDARD)
@@ -686,12 +659,6 @@
return type;
}
-// static
-const Clipboard::FormatType& Clipboard::GetSourceTagFormatType() {
- CR_DEFINE_STATIC_LOCAL(FormatType, type, (kSourceTagType));
- return type;
-}
-
void Clipboard::InsertMapping(const char* key,
char* data,
size_t data_len) {
« 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