summaryrefslogtreecommitdiffstats
path: root/ui/base/clipboard/clipboard_gtk.cc
diff options
context:
space:
mode:
authorerg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-09 23:51:49 +0000
committererg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-09 23:51:49 +0000
commit91e0e293fdf8be438d14b8ca25537fe3785aa3bf (patch)
tree766e49d5fa4c23200744d9a6af432944cd635b49 /ui/base/clipboard/clipboard_gtk.cc
parent5bead4818d6bf5bfb9d75f943f2312ea20d7d944 (diff)
downloadchromium_src-91e0e293fdf8be438d14b8ca25537fe3785aa3bf.zip
chromium_src-91e0e293fdf8be438d14b8ca25537fe3785aa3bf.tar.gz
chromium_src-91e0e293fdf8be438d14b8ca25537fe3785aa3bf.tar.bz2
GTK: Seal up GSEALs, focusing on GtkSelectionData.
BUG=79722 TEST=compiles Review URL: http://codereview.chromium.org/9151007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116956 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/clipboard/clipboard_gtk.cc')
-rw-r--r--ui/base/clipboard/clipboard_gtk.cc33
1 files changed, 22 insertions, 11 deletions
diff --git a/ui/base/clipboard/clipboard_gtk.cc b/ui/base/clipboard/clipboard_gtk.cc
index 5b6a1a9..b1ea51b 100644
--- a/ui/base/clipboard/clipboard_gtk.cc
+++ b/ui/base/clipboard/clipboard_gtk.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -129,7 +129,8 @@ void GetData(GtkClipboard* clipboard,
Clipboard::TargetMap* data_map =
reinterpret_cast<Clipboard::TargetMap*>(user_data);
- std::string target_string = GdkAtomToString(selection_data->target);
+ std::string target_string = GdkAtomToString(
+ gtk_selection_data_get_target(selection_data));
Clipboard::TargetMap::iterator iter = data_map->find(target_string);
if (iter == data_map->end())
@@ -139,7 +140,8 @@ void GetData(GtkClipboard* clipboard,
gtk_selection_data_set_pixbuf(selection_data,
reinterpret_cast<GdkPixbuf*>(iter->second.first));
} else {
- gtk_selection_data_set(selection_data, selection_data->target, 8,
+ gtk_selection_data_set(selection_data,
+ gtk_selection_data_get_target(selection_data), 8,
reinterpret_cast<guchar*>(iter->second.first),
iter->second.second);
}
@@ -421,7 +423,9 @@ void Clipboard::ReadAvailableTypes(Clipboard::Buffer buffer,
clipboard, GetWebCustomDataFormatType().ToGdkAtom());
if (!data)
return;
- ReadCustomDataTypes(data->data, data->length, types);
+ ReadCustomDataTypes(gtk_selection_data_get_data(data),
+ gtk_selection_data_get_length(data),
+ types);
gtk_selection_data_free(data);
}
@@ -484,12 +488,15 @@ void Clipboard::ReadHTML(Clipboard::Buffer buffer, string16* markup,
// If the data starts with 0xFEFF, i.e., Byte Order Mark, assume it is
// UTF-16, otherwise assume UTF-8.
- if (data->length >= 2 &&
- reinterpret_cast<uint16_t*>(data->data)[0] == 0xFEFF) {
- markup->assign(reinterpret_cast<uint16_t*>(data->data) + 1,
- (data->length / 2) - 1);
+ gint data_length = gtk_selection_data_get_length(data);
+ const guchar* raw_data = gtk_selection_data_get_data(data);
+
+ if (data_length >= 2 &&
+ reinterpret_cast<const uint16_t*>(raw_data)[0] == 0xFEFF) {
+ markup->assign(reinterpret_cast<const uint16_t*>(raw_data) + 1,
+ (data_length / 2) - 1);
} else {
- UTF8ToUTF16(reinterpret_cast<char*>(data->data), data->length, markup);
+ UTF8ToUTF16(reinterpret_cast<const char*>(raw_data), data_length, markup);
}
// If there is a terminating NULL, drop it.
@@ -532,7 +539,9 @@ void Clipboard::ReadCustomData(Buffer buffer,
clipboard, GetWebCustomDataFormatType().ToGdkAtom());
if (!data)
return;
- ReadCustomDataForType(data->data, data->length, type, result);
+ ReadCustomDataForType(gtk_selection_data_get_data(data),
+ gtk_selection_data_get_length(data),
+ type, result);
gtk_selection_data_free(data);
}
@@ -546,7 +555,9 @@ void Clipboard::ReadData(const FormatType& format, std::string* result) const {
gtk_clipboard_wait_for_contents(clipboard_, format.ToGdkAtom());
if (!data)
return;
- result->assign(reinterpret_cast<char*>(data->data), data->length);
+ result->assign(reinterpret_cast<const char*>(
+ gtk_selection_data_get_data(data)),
+ gtk_selection_data_get_length(data));
gtk_selection_data_free(data);
}