| OLD | NEW |
| 1 // Copyright (c) 2008-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008-2009 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/mac_util.h" | 5 #include "base/mac_util.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // also be true when un-excluding the file, otherwise the un-excluding | 247 // also be true when un-excluding the file, otherwise the un-excluding |
| 248 // will be ignored. | 248 // will be ignored. |
| 249 bool success = | 249 bool success = |
| 250 CSBackupSetItemExcluded((CFURLRef)url, exclude, true) == noErr; | 250 CSBackupSetItemExcluded((CFURLRef)url, exclude, true) == noErr; |
| 251 if (!success) | 251 if (!success) |
| 252 LOG(WARNING) << "Failed to set backup excluson for file '" | 252 LOG(WARNING) << "Failed to set backup excluson for file '" |
| 253 << file_path.value().c_str() << "'. Continuing."; | 253 << file_path.value().c_str() << "'. Continuing."; |
| 254 return success; | 254 return success; |
| 255 } | 255 } |
| 256 | 256 |
| 257 CFTypeRef GetValueFromDictionary(CFDictionaryRef dict, |
| 258 CFStringRef key, |
| 259 CFTypeID expected_type) { |
| 260 CFTypeRef value = CFDictionaryGetValue(dict, key); |
| 261 if (!value) |
| 262 return value; |
| 263 |
| 264 if (CFGetTypeID(value) != expected_type) { |
| 265 scoped_cftyperef<CFStringRef> expected_type_ref( |
| 266 CFCopyTypeIDDescription(expected_type)); |
| 267 scoped_cftyperef<CFStringRef> actual_type_ref( |
| 268 CFCopyTypeIDDescription(CFGetTypeID(value))); |
| 269 LOG(WARNING) << "Expected value for key " |
| 270 << base::SysCFStringRefToUTF8(key) |
| 271 << " to be " |
| 272 << base::SysCFStringRefToUTF8(expected_type_ref) |
| 273 << " but it was " |
| 274 << base::SysCFStringRefToUTF8(actual_type_ref) |
| 275 << " instead"; |
| 276 return NULL; |
| 277 } |
| 278 |
| 279 return value; |
| 280 } |
| 257 | 281 |
| 258 } // namespace mac_util | 282 } // namespace mac_util |
| OLD | NEW |