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

Side by Side Diff: base/sys_string_conversions_mac.mm

Issue 10919185: Implement RemovableDeviceNotifications for Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments Created 8 years, 3 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 | Annotate | Revision Log
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 "base/sys_string_conversions.h" 5 #include "base/sys_string_conversions.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 return (NSString*)base::mac::CFTypeRefToNSObjectAutorelease( 156 return (NSString*)base::mac::CFTypeRefToNSObjectAutorelease(
157 SysUTF8ToCFStringRef(utf8)); 157 SysUTF8ToCFStringRef(utf8));
158 } 158 }
159 159
160 NSString* SysUTF16ToNSString(const string16& utf16) { 160 NSString* SysUTF16ToNSString(const string16& utf16) {
161 return (NSString*)base::mac::CFTypeRefToNSObjectAutorelease( 161 return (NSString*)base::mac::CFTypeRefToNSObjectAutorelease(
162 SysUTF16ToCFStringRef(utf16)); 162 SysUTF16ToCFStringRef(utf16));
163 } 163 }
164 164
165 std::string SysCFStringRefToUTF8(CFStringRef ref) { 165 std::string SysCFStringRefToUTF8(CFStringRef ref) {
166 if (!ref)
Mark Mentovai 2012/09/12 21:05:15 This intentionally does not operate on NULL input
sail 2012/09/12 22:38:26 Done. (I'm not sure I understand this. Round-trip
Mark Mentovai 2012/09/12 22:45:26 sail wrote:
167 return std::string();
166 return CFStringToSTLStringWithEncodingT<std::string>(ref, 168 return CFStringToSTLStringWithEncodingT<std::string>(ref,
167 kNarrowStringEncoding); 169 kNarrowStringEncoding);
168 } 170 }
169 171
170 string16 SysCFStringRefToUTF16(CFStringRef ref) { 172 string16 SysCFStringRefToUTF16(CFStringRef ref) {
173 if (!ref)
174 return string16();
171 return CFStringToSTLStringWithEncodingT<string16>(ref, 175 return CFStringToSTLStringWithEncodingT<string16>(ref,
172 kMediumStringEncoding); 176 kMediumStringEncoding);
173 } 177 }
174 178
175 std::string SysNSStringToUTF8(NSString* nsstring) { 179 std::string SysNSStringToUTF8(NSString* nsstring) {
176 if (!nsstring) 180 if (!nsstring)
177 return std::string(); 181 return std::string();
178 return SysCFStringRefToUTF8(reinterpret_cast<CFStringRef>(nsstring)); 182 return SysCFStringRefToUTF8(reinterpret_cast<CFStringRef>(nsstring));
179 } 183 }
180 184
181 string16 SysNSStringToUTF16(NSString* nsstring) { 185 string16 SysNSStringToUTF16(NSString* nsstring) {
182 if (!nsstring) 186 if (!nsstring)
183 return string16(); 187 return string16();
184 return SysCFStringRefToUTF16(reinterpret_cast<CFStringRef>(nsstring)); 188 return SysCFStringRefToUTF16(reinterpret_cast<CFStringRef>(nsstring));
185 } 189 }
186 190
187 } // namespace base 191 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698