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 "rlz/mac/lib/rlz_value_store_mac.h" | 5 #include "rlz/mac/lib/rlz_value_store_mac.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } | 60 } |
61 | 61 |
62 bool RlzValueStoreMac::HasAccess(AccessType type) { | 62 bool RlzValueStoreMac::HasAccess(AccessType type) { |
63 NSFileManager* manager = [NSFileManager defaultManager]; | 63 NSFileManager* manager = [NSFileManager defaultManager]; |
64 switch (type) { | 64 switch (type) { |
65 case kReadAccess: return [manager isReadableFileAtPath:plist_path_]; | 65 case kReadAccess: return [manager isReadableFileAtPath:plist_path_]; |
66 case kWriteAccess: return [manager isWritableFileAtPath:plist_path_]; | 66 case kWriteAccess: return [manager isWritableFileAtPath:plist_path_]; |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 bool RlzValueStoreMac::WritePingTime(Product product, int64 time) { | 70 bool RlzValueStoreMac::WritePingTime(Product product, int64_t time) { |
71 NSNumber* n = [NSNumber numberWithLongLong:time]; | 71 NSNumber* n = [NSNumber numberWithLongLong:time]; |
72 [ProductDict(product) setObject:n forKey:kPingTimeKey]; | 72 [ProductDict(product) setObject:n forKey:kPingTimeKey]; |
73 return true; | 73 return true; |
74 } | 74 } |
75 | 75 |
76 bool RlzValueStoreMac::ReadPingTime(Product product, int64* time) { | 76 bool RlzValueStoreMac::ReadPingTime(Product product, int64_t* time) { |
77 if (NSNumber* n = | 77 if (NSNumber* n = |
78 ObjCCast<NSNumber>([ProductDict(product) objectForKey:kPingTimeKey])) { | 78 ObjCCast<NSNumber>([ProductDict(product) objectForKey:kPingTimeKey])) { |
79 *time = [n longLongValue]; | 79 *time = [n longLongValue]; |
80 return true; | 80 return true; |
81 } | 81 } |
82 return false; | 82 return false; |
83 } | 83 } |
84 | 84 |
85 bool RlzValueStoreMac::ClearPingTime(Product product) { | 85 bool RlzValueStoreMac::ClearPingTime(Product product) { |
86 [ProductDict(product) removeObjectForKey:kPingTimeKey]; | 86 [ProductDict(product) removeObjectForKey:kPingTimeKey]; |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 364 |
365 std::string RlzStoreFilenameStr() { | 365 std::string RlzStoreFilenameStr() { |
366 @autoreleasepool { | 366 @autoreleasepool { |
367 return std::string([RlzPlistFilename() fileSystemRepresentation]); | 367 return std::string([RlzPlistFilename() fileSystemRepresentation]); |
368 } | 368 } |
369 } | 369 } |
370 | 370 |
371 } // namespace testing | 371 } // namespace testing |
372 | 372 |
373 } // namespace rlz_lib | 373 } // namespace rlz_lib |
OLD | NEW |