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 #include "update_engine/utils.h" | 12 #include "update_engine/utils.h" |
12 | 13 |
13 using std::string; | 14 using std::string; |
14 | 15 |
15 namespace chromeos_update_engine { | 16 namespace chromeos_update_engine { |
16 | 17 |
| 18 const char kPrefsDeltaUpdateFailures[] = "delta-update-failures"; |
17 const char kPrefsLastActivePingDay[] = "last-active-ping-day"; | 19 const char kPrefsLastActivePingDay[] = "last-active-ping-day"; |
18 const char kPrefsLastRollCallPingDay[] = "last-roll-call-ping-day"; | 20 const char kPrefsLastRollCallPingDay[] = "last-roll-call-ping-day"; |
19 | 21 |
20 bool Prefs::Init(const FilePath& prefs_dir) { | 22 bool Prefs::Init(const FilePath& prefs_dir) { |
21 prefs_dir_ = prefs_dir; | 23 prefs_dir_ = prefs_dir; |
22 return true; | 24 return true; |
23 } | 25 } |
24 | 26 |
25 bool Prefs::GetString(const string& key, string* value) { | 27 bool Prefs::GetString(const string& key, string* value) { |
26 LOG(INFO) << "Getting key \"" << key << "\""; | 28 LOG(INFO) << "Getting key \"" << key << "\""; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 for (size_t i = 0; i < key.size(); ++i) { | 62 for (size_t i = 0; i < key.size(); ++i) { |
61 char c = key.at(i); | 63 char c = key.at(i); |
62 TEST_AND_RETURN_FALSE(IsAsciiAlpha(c) || IsAsciiDigit(c) || | 64 TEST_AND_RETURN_FALSE(IsAsciiAlpha(c) || IsAsciiDigit(c) || |
63 c == '_' || c == '-'); | 65 c == '_' || c == '-'); |
64 } | 66 } |
65 *filename = prefs_dir_.Append(key); | 67 *filename = prefs_dir_.Append(key); |
66 return true; | 68 return true; |
67 } | 69 } |
68 | 70 |
69 } // namespace chromeos_update_engine | 71 } // namespace chromeos_update_engine |
OLD | NEW |