OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 "update_engine/prefs.h" | 5 #include "update_engine/prefs.h" |
6 | 6 |
7 #include <base/file_util.h> | 7 #include <base/file_util.h> |
8 #include <base/logging.h> | 8 #include <base/logging.h> |
9 #include <base/string_number_conversions.h> | 9 #include <base/string_number_conversions.h> |
10 #include <base/string_util.h> | 10 #include <base/string_util.h> |
11 | 11 |
12 #include "update_engine/utils.h" | 12 #include "update_engine/utils.h" |
13 | 13 |
14 using std::string; | 14 using std::string; |
15 | 15 |
16 namespace chromeos_update_engine { | 16 namespace chromeos_update_engine { |
17 | 17 |
18 const char kPrefsDeltaUpdateFailures[] = "delta-update-failures"; | 18 const char kPrefsDeltaUpdateFailures[] = "delta-update-failures"; |
19 const char kPrefsLastActivePingDay[] = "last-active-ping-day"; | 19 const char kPrefsLastActivePingDay[] = "last-active-ping-day"; |
20 const char kPrefsLastRollCallPingDay[] = "last-roll-call-ping-day"; | 20 const char kPrefsLastRollCallPingDay[] = "last-roll-call-ping-day"; |
21 const char kPrefsManifestMetadataSize[] = "manifest-metadata-size"; | 21 const char kPrefsManifestMetadataSize[] = "manifest-metadata-size"; |
| 22 const char kPrefsPreviousVersion[] = "previous-version"; |
22 const char kPrefsResumedUpdateFailures[] = "resumed-update-failures"; | 23 const char kPrefsResumedUpdateFailures[] = "resumed-update-failures"; |
23 const char kPrefsUpdateCheckResponseHash[] = "update-check-response-hash"; | 24 const char kPrefsUpdateCheckResponseHash[] = "update-check-response-hash"; |
24 const char kPrefsUpdateStateNextDataOffset[] = "update-state-next-data-offset"; | 25 const char kPrefsUpdateStateNextDataOffset[] = "update-state-next-data-offset"; |
25 const char kPrefsUpdateStateNextOperation[] = "update-state-next-operation"; | 26 const char kPrefsUpdateStateNextOperation[] = "update-state-next-operation"; |
26 const char kPrefsUpdateStateSHA256Context[] = "update-state-sha-256-context"; | 27 const char kPrefsUpdateStateSHA256Context[] = "update-state-sha-256-context"; |
27 const char kPrefsUpdateStateSignedSHA256Context[] = | 28 const char kPrefsUpdateStateSignedSHA256Context[] = |
28 "update-state-signed-sha-256-context"; | 29 "update-state-signed-sha-256-context"; |
29 | 30 |
30 bool Prefs::Init(const FilePath& prefs_dir) { | 31 bool Prefs::Init(const FilePath& prefs_dir) { |
31 prefs_dir_ = prefs_dir; | 32 prefs_dir_ = prefs_dir; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 for (size_t i = 0; i < key.size(); ++i) { | 72 for (size_t i = 0; i < key.size(); ++i) { |
72 char c = key.at(i); | 73 char c = key.at(i); |
73 TEST_AND_RETURN_FALSE(IsAsciiAlpha(c) || IsAsciiDigit(c) || | 74 TEST_AND_RETURN_FALSE(IsAsciiAlpha(c) || IsAsciiDigit(c) || |
74 c == '_' || c == '-'); | 75 c == '_' || c == '-'); |
75 } | 76 } |
76 *filename = prefs_dir_.Append(key); | 77 *filename = prefs_dir_.Append(key); |
77 return true; | 78 return true; |
78 } | 79 } |
79 | 80 |
80 } // namespace chromeos_update_engine | 81 } // namespace chromeos_update_engine |
OLD | NEW |