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

Side by Side Diff: ui/base/dragdrop/os_exchange_data_provider_aurax11.cc

Issue 1154283003: Change most uses of Pickle to base::Pickle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
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/dragdrop/os_exchange_data_provider_aurax11.h" 5 #include "ui/base/dragdrop/os_exchange_data_provider_aurax11.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 199 }
200 200
201 std::string joined_data = JoinString(paths, '\n'); 201 std::string joined_data = JoinString(paths, '\n');
202 scoped_refptr<base::RefCountedMemory> mem( 202 scoped_refptr<base::RefCountedMemory> mem(
203 base::RefCountedString::TakeString(&joined_data)); 203 base::RefCountedString::TakeString(&joined_data));
204 format_map_.Insert(atom_cache_.GetAtom(Clipboard::kMimeTypeURIList), mem); 204 format_map_.Insert(atom_cache_.GetAtom(Clipboard::kMimeTypeURIList), mem);
205 } 205 }
206 206
207 void OSExchangeDataProviderAuraX11::SetPickledData( 207 void OSExchangeDataProviderAuraX11::SetPickledData(
208 const OSExchangeData::CustomFormat& format, 208 const OSExchangeData::CustomFormat& format,
209 const Pickle& pickle) { 209 const base::Pickle& pickle) {
210 const unsigned char* data = 210 const unsigned char* data =
211 reinterpret_cast<const unsigned char*>(pickle.data()); 211 reinterpret_cast<const unsigned char*>(pickle.data());
212 212
213 std::vector<unsigned char> bytes; 213 std::vector<unsigned char> bytes;
214 bytes.insert(bytes.end(), data, data + pickle.size()); 214 bytes.insert(bytes.end(), data, data + pickle.size());
215 scoped_refptr<base::RefCountedMemory> mem( 215 scoped_refptr<base::RefCountedMemory> mem(
216 base::RefCountedBytes::TakeVector(&bytes)); 216 base::RefCountedBytes::TakeVector(&bytes));
217 217
218 format_map_.Insert(atom_cache_.GetAtom(format.ToString().c_str()), mem); 218 format_map_.Insert(atom_cache_.GetAtom(format.ToString().c_str()), mem);
219 } 219 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 filenames->push_back(FileInfo(file_path, base::FilePath())); 317 filenames->push_back(FileInfo(file_path, base::FilePath()));
318 } 318 }
319 } 319 }
320 } 320 }
321 321
322 return !filenames->empty(); 322 return !filenames->empty();
323 } 323 }
324 324
325 bool OSExchangeDataProviderAuraX11::GetPickledData( 325 bool OSExchangeDataProviderAuraX11::GetPickledData(
326 const OSExchangeData::CustomFormat& format, 326 const OSExchangeData::CustomFormat& format,
327 Pickle* pickle) const { 327 base::Pickle* pickle) const {
328 std::vector< ::Atom> requested_types; 328 std::vector< ::Atom> requested_types;
329 requested_types.push_back(atom_cache_.GetAtom(format.ToString().c_str())); 329 requested_types.push_back(atom_cache_.GetAtom(format.ToString().c_str()));
330 330
331 ui::SelectionData data(format_map_.GetFirstOf(requested_types)); 331 ui::SelectionData data(format_map_.GetFirstOf(requested_types));
332 if (data.IsValid()) { 332 if (data.IsValid()) {
333 // Note that the pickle object on the right hand side of the assignment 333 // Note that the pickle object on the right hand side of the assignment
334 // only refers to the bytes in |data|. The assignment copies the data. 334 // only refers to the bytes in |data|. The assignment copies the data.
335 *pickle = Pickle(reinterpret_cast<const char*>(data.GetData()), 335 *pickle = base::Pickle(reinterpret_cast<const char*>(data.GetData()),
336 static_cast<int>(data.GetSize())); 336 static_cast<int>(data.GetSize()));
337 return true; 337 return true;
338 } 338 }
339 339
340 return false; 340 return false;
341 } 341 }
342 342
343 bool OSExchangeDataProviderAuraX11::HasString() const { 343 bool OSExchangeDataProviderAuraX11::HasString() const {
344 std::vector< ::Atom> text_atoms = ui::GetTextAtomsFrom(&atom_cache_); 344 std::vector< ::Atom> text_atoms = ui::GetTextAtomsFrom(&atom_cache_);
345 std::vector< ::Atom> requested_types; 345 std::vector< ::Atom> requested_types;
346 ui::GetAtomIntersection(text_atoms, GetTargets(), &requested_types); 346 ui::GetAtomIntersection(text_atoms, GetTargets(), &requested_types);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 544
545 /////////////////////////////////////////////////////////////////////////////// 545 ///////////////////////////////////////////////////////////////////////////////
546 // OSExchangeData, public: 546 // OSExchangeData, public:
547 547
548 // static 548 // static
549 OSExchangeData::Provider* OSExchangeData::CreateProvider() { 549 OSExchangeData::Provider* OSExchangeData::CreateProvider() {
550 return new OSExchangeDataProviderAuraX11(); 550 return new OSExchangeDataProviderAuraX11();
551 } 551 }
552 552
553 } // namespace ui 553 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/dragdrop/os_exchange_data_provider_aura.cc ('k') | ui/base/dragdrop/os_exchange_data_provider_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698