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

Side by Side Diff: ui/base/dragdrop/os_exchange_data_provider_mac.mm

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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_mac.h" 5 #include "ui/base/dragdrop/os_exchange_data_provider_mac.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 forType:NSFilenamesPboardType]; 56 forType:NSFilenamesPboardType];
57 } 57 }
58 58
59 void OSExchangeDataProviderMac::SetFilenames( 59 void OSExchangeDataProviderMac::SetFilenames(
60 const std::vector<FileInfo>& filenames) { 60 const std::vector<FileInfo>& filenames) {
61 NOTIMPLEMENTED(); 61 NOTIMPLEMENTED();
62 } 62 }
63 63
64 void OSExchangeDataProviderMac::SetPickledData( 64 void OSExchangeDataProviderMac::SetPickledData(
65 const OSExchangeData::CustomFormat& format, 65 const OSExchangeData::CustomFormat& format,
66 const Pickle& data) { 66 const base::Pickle& data) {
67 NSData* ns_data = [NSData dataWithBytes:data.data() length:data.size()]; 67 NSData* ns_data = [NSData dataWithBytes:data.data() length:data.size()];
68 [pasteboard_ setData:ns_data forType:format.ToNSString()]; 68 [pasteboard_ setData:ns_data forType:format.ToNSString()];
69 } 69 }
70 70
71 bool OSExchangeDataProviderMac::GetString(base::string16* data) const { 71 bool OSExchangeDataProviderMac::GetString(base::string16* data) const {
72 DCHECK(data); 72 DCHECK(data);
73 NSArray* items = [pasteboard_ readObjectsForClasses:@[ [NSString class] ] 73 NSArray* items = [pasteboard_ readObjectsForClasses:@[ [NSString class] ]
74 options:@{ }]; 74 options:@{ }];
75 if ([items count] == 0) 75 if ([items count] == 0)
76 return false; 76 return false;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 120
121 bool OSExchangeDataProviderMac::GetFilenames( 121 bool OSExchangeDataProviderMac::GetFilenames(
122 std::vector<FileInfo>* filenames) const { 122 std::vector<FileInfo>* filenames) const {
123 NOTIMPLEMENTED(); 123 NOTIMPLEMENTED();
124 return false; 124 return false;
125 } 125 }
126 126
127 bool OSExchangeDataProviderMac::GetPickledData( 127 bool OSExchangeDataProviderMac::GetPickledData(
128 const OSExchangeData::CustomFormat& format, 128 const OSExchangeData::CustomFormat& format,
129 Pickle* data) const { 129 base::Pickle* data) const {
130 DCHECK(data); 130 DCHECK(data);
131 NSData* ns_data = [pasteboard_ dataForType:format.ToNSString()]; 131 NSData* ns_data = [pasteboard_ dataForType:format.ToNSString()];
132 if (!ns_data) 132 if (!ns_data)
133 return false; 133 return false;
134 134
135 *data = Pickle(static_cast<const char*>([ns_data bytes]), [ns_data length]); 135 *data =
136 base::Pickle(static_cast<const char*>([ns_data bytes]), [ns_data length]);
136 return true; 137 return true;
137 } 138 }
138 139
139 bool OSExchangeDataProviderMac::HasString() const { 140 bool OSExchangeDataProviderMac::HasString() const {
140 NSArray* classes = @[ [NSString class] ]; 141 NSArray* classes = @[ [NSString class] ];
141 return [pasteboard_ canReadObjectForClasses:classes options:nil]; 142 return [pasteboard_ canReadObjectForClasses:classes options:nil];
142 } 143 }
143 144
144 bool OSExchangeDataProviderMac::HasURL( 145 bool OSExchangeDataProviderMac::HasURL(
145 OSExchangeData::FilenameToURLPolicy policy) const { 146 OSExchangeData::FilenameToURLPolicy policy) const {
(...skipping 13 matching lines...) Expand all
159 160
160 /////////////////////////////////////////////////////////////////////////////// 161 ///////////////////////////////////////////////////////////////////////////////
161 // OSExchangeData, public: 162 // OSExchangeData, public:
162 163
163 // static 164 // static
164 OSExchangeData::Provider* OSExchangeData::CreateProvider() { 165 OSExchangeData::Provider* OSExchangeData::CreateProvider() {
165 return new OSExchangeDataProviderMac; 166 return new OSExchangeDataProviderMac;
166 } 167 }
167 168
168 } // namespace ui 169 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/dragdrop/os_exchange_data_provider_aurax11.cc ('k') | ui/base/dragdrop/os_exchange_data_provider_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698