| Index: ui/base/clipboard/clipboard_gtk.cc
|
| diff --git a/ui/base/clipboard/clipboard_gtk.cc b/ui/base/clipboard/clipboard_gtk.cc
|
| index 5b6a1a902db0e884dc34f6a2029cd846c66b7bd0..b1ea51b229c12a5e863ad10d16951037707062ac 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);
|
| }
|
|
|
|
|