| OLD | NEW |
| 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/dragdrop/gtk_dnd_util.h" | 5 #include "ui/base/dragdrop/gtk_dnd_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 bool ExtractNamedURL(GtkSelectionData* selection_data, | 209 bool ExtractNamedURL(GtkSelectionData* selection_data, |
| 210 GURL* url, | 210 GURL* url, |
| 211 string16* title) { | 211 string16* title) { |
| 212 if (!selection_data || gtk_selection_data_get_length(selection_data) <= 0) | 212 if (!selection_data || gtk_selection_data_get_length(selection_data) <= 0) |
| 213 return false; | 213 return false; |
| 214 | 214 |
| 215 Pickle data( | 215 Pickle data( |
| 216 reinterpret_cast<const char*>( | 216 reinterpret_cast<const char*>( |
| 217 gtk_selection_data_get_data(selection_data)), | 217 gtk_selection_data_get_data(selection_data)), |
| 218 gtk_selection_data_get_length(selection_data)); | 218 gtk_selection_data_get_length(selection_data)); |
| 219 void* iter = NULL; | 219 PickleIterator iter(data); |
| 220 std::string title_utf8, url_utf8; | 220 std::string title_utf8, url_utf8; |
| 221 if (!data.ReadString(&iter, &title_utf8) || | 221 if (!data.ReadString(&iter, &title_utf8) || |
| 222 !data.ReadString(&iter, &url_utf8)) { | 222 !data.ReadString(&iter, &url_utf8)) { |
| 223 return false; | 223 return false; |
| 224 } | 224 } |
| 225 | 225 |
| 226 GURL gurl(url_utf8); | 226 GURL gurl(url_utf8); |
| 227 if (!gurl.is_valid()) | 227 if (!gurl.is_valid()) |
| 228 return false; | 228 return false; |
| 229 | 229 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 GURL gurl(data.substr(0, newline)); | 266 GURL gurl(data.substr(0, newline)); |
| 267 if (!gurl.is_valid()) | 267 if (!gurl.is_valid()) |
| 268 return false; | 268 return false; |
| 269 | 269 |
| 270 *url = gurl; | 270 *url = gurl; |
| 271 *title = UTF8ToUTF16(data.substr(newline + 1)); | 271 *title = UTF8ToUTF16(data.substr(newline + 1)); |
| 272 return true; | 272 return true; |
| 273 } | 273 } |
| 274 | 274 |
| 275 } // namespace ui | 275 } // namespace ui |
| OLD | NEW |