| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 140 } |
| 141 TrimWhitespaceASCII(hwid, TRIM_ALL, &hwid); | 141 TrimWhitespaceASCII(hwid, TRIM_ALL, &hwid); |
| 142 return hwid; | 142 return hwid; |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool OmahaRequestDeviceParams::IsOfficialBuild() const { | 145 bool OmahaRequestDeviceParams::IsOfficialBuild() const { |
| 146 return force_build_type_ ? forced_official_build_ : utils::IsOfficialBuild(); | 146 return force_build_type_ ? forced_official_build_ : utils::IsOfficialBuild(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 bool OmahaRequestDeviceParams::IsValidTrack(const std::string& track) const { | 149 bool OmahaRequestDeviceParams::IsValidTrack(const std::string& track) const { |
| 150 return IsOfficialBuild() ? | 150 static const char* kValidTracks[] = { |
| 151 (track == "beta-channel" || track == "dev-channel") : true; | 151 "canary-channel", |
| 152 "beta-channel", |
| 153 "dev-channel", |
| 154 }; |
| 155 if (!IsOfficialBuild()) { |
| 156 return true; |
| 157 } |
| 158 for (size_t t = 0; t < arraysize(kValidTracks); ++t) { |
| 159 if (track == kValidTracks[t]) { |
| 160 return true; |
| 161 } |
| 162 } |
| 163 return false; |
| 152 } | 164 } |
| 153 | 165 |
| 154 void OmahaRequestDeviceParams::SetBuildTypeOfficial(bool is_official) { | 166 void OmahaRequestDeviceParams::SetBuildTypeOfficial(bool is_official) { |
| 155 force_build_type_ = true; | 167 force_build_type_ = true; |
| 156 forced_official_build_ = is_official; | 168 forced_official_build_ = is_official; |
| 157 } | 169 } |
| 158 | 170 |
| 159 } // namespace chromeos_update_engine | 171 } // namespace chromeos_update_engine |
| OLD | NEW |