| 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/omaha_request_params.h" | 5 #include "update_engine/omaha_request_params.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <sys/utsname.h> | 9 #include <sys/utsname.h> |
| 10 | 10 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 bool OmahaRequestDeviceParams::ShouldLockDown() const { | 178 bool OmahaRequestDeviceParams::ShouldLockDown() const { |
| 179 if (force_lock_down_) { | 179 if (force_lock_down_) { |
| 180 return forced_lock_down_; | 180 return forced_lock_down_; |
| 181 } | 181 } |
| 182 return utils::IsOfficialBuild() && utils::IsNormalBootMode(); | 182 return utils::IsOfficialBuild() && utils::IsNormalBootMode(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 bool OmahaRequestDeviceParams::IsValidTrack(const std::string& track) const { | 185 bool OmahaRequestDeviceParams::IsValidTrack(const std::string& track) const { |
| 186 static const char* kValidTracks[] = { | 186 static const char* kValidTracks[] = { |
| 187 "canary-channel", | 187 "canary-channel", |
| 188 "stable-channel", |
| 188 "beta-channel", | 189 "beta-channel", |
| 189 "dev-channel", | 190 "dev-channel", |
| 190 }; | 191 }; |
| 191 if (!ShouldLockDown()) { | 192 if (!ShouldLockDown()) { |
| 192 return true; | 193 return true; |
| 193 } | 194 } |
| 194 for (size_t t = 0; t < arraysize(kValidTracks); ++t) { | 195 for (size_t t = 0; t < arraysize(kValidTracks); ++t) { |
| 195 if (track == kValidTracks[t]) { | 196 if (track == kValidTracks[t]) { |
| 196 return true; | 197 return true; |
| 197 } | 198 } |
| 198 } | 199 } |
| 199 return false; | 200 return false; |
| 200 } | 201 } |
| 201 | 202 |
| 202 void OmahaRequestDeviceParams::SetLockDown(bool lock) { | 203 void OmahaRequestDeviceParams::SetLockDown(bool lock) { |
| 203 force_lock_down_ = true; | 204 force_lock_down_ = true; |
| 204 forced_lock_down_ = lock; | 205 forced_lock_down_ = lock; |
| 205 } | 206 } |
| 206 | 207 |
| 207 } // namespace chromeos_update_engine | 208 } // namespace chromeos_update_engine |
| OLD | NEW |