| 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/chromeos/lib/rlz_value_store_chromeos.h" | 5 #include "rlz/chromeos/lib/rlz_value_store_chromeos.h" |
| 6 | 6 |
| 7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/important_file_writer.h" | 9 #include "base/files/important_file_writer.h" |
| 10 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 RlzValueStoreChromeOS::~RlzValueStoreChromeOS() { | 88 RlzValueStoreChromeOS::~RlzValueStoreChromeOS() { |
| 89 WriteStore(); | 89 WriteStore(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 bool RlzValueStoreChromeOS::HasAccess(AccessType type) { | 92 bool RlzValueStoreChromeOS::HasAccess(AccessType type) { |
| 93 DCHECK(CalledOnValidThread()); | 93 DCHECK(CalledOnValidThread()); |
| 94 return type == kReadAccess || !read_only_; | 94 return type == kReadAccess || !read_only_; |
| 95 } | 95 } |
| 96 | 96 |
| 97 bool RlzValueStoreChromeOS::WritePingTime(Product product, int64 time) { | 97 bool RlzValueStoreChromeOS::WritePingTime(Product product, int64_t time) { |
| 98 DCHECK(CalledOnValidThread()); | 98 DCHECK(CalledOnValidThread()); |
| 99 rlz_store_->SetString(GetKeyName(kPingTimeKey, product), | 99 rlz_store_->SetString(GetKeyName(kPingTimeKey, product), |
| 100 base::Int64ToString(time)); | 100 base::Int64ToString(time)); |
| 101 return true; | 101 return true; |
| 102 } | 102 } |
| 103 | 103 |
| 104 bool RlzValueStoreChromeOS::ReadPingTime(Product product, int64* time) { | 104 bool RlzValueStoreChromeOS::ReadPingTime(Product product, int64_t* time) { |
| 105 DCHECK(CalledOnValidThread()); | 105 DCHECK(CalledOnValidThread()); |
| 106 std::string ping_time; | 106 std::string ping_time; |
| 107 return rlz_store_->GetString(GetKeyName(kPingTimeKey, product), &ping_time) && | 107 return rlz_store_->GetString(GetKeyName(kPingTimeKey, product), &ping_time) && |
| 108 base::StringToInt64(ping_time, time); | 108 base::StringToInt64(ping_time, time); |
| 109 } | 109 } |
| 110 | 110 |
| 111 bool RlzValueStoreChromeOS::ClearPingTime(Product product) { | 111 bool RlzValueStoreChromeOS::ClearPingTime(Product product) { |
| 112 DCHECK(CalledOnValidThread()); | 112 DCHECK(CalledOnValidThread()); |
| 113 rlz_store_->Remove(GetKeyName(kPingTimeKey, product), NULL); | 113 rlz_store_->Remove(GetKeyName(kPingTimeKey, product), NULL); |
| 114 return true; | 114 return true; |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 g_testing_rlz_store_path_ = directory; | 333 g_testing_rlz_store_path_ = directory; |
| 334 } | 334 } |
| 335 | 335 |
| 336 std::string RlzStoreFilenameStr() { | 336 std::string RlzStoreFilenameStr() { |
| 337 return GetRlzStorePath().value(); | 337 return GetRlzStorePath().value(); |
| 338 } | 338 } |
| 339 | 339 |
| 340 } // namespace testing | 340 } // namespace testing |
| 341 | 341 |
| 342 } // namespace rlz_lib | 342 } // namespace rlz_lib |
| OLD | NEW |