Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: omaha_request_params.cc

Issue 4181001: AU: Implement getting of tracks through GetTrack. (Closed) Base URL: http://git.chromium.org/git/update_engine.git
Patch Set: sort by names Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « omaha_request_params.h ('k') | update_engine.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 app_track = track; 85 app_track = track;
86 return true; 86 return true;
87 } 87 }
88 88
89 bool OmahaRequestDeviceParams::SetDeviceTrack(const std::string& track) { 89 bool OmahaRequestDeviceParams::SetDeviceTrack(const std::string& track) {
90 OmahaRequestDeviceParams params; 90 OmahaRequestDeviceParams params;
91 TEST_AND_RETURN_FALSE(params.Init("", "")); 91 TEST_AND_RETURN_FALSE(params.Init("", ""));
92 return params.SetTrack(track); 92 return params.SetTrack(track);
93 } 93 }
94 94
95 string OmahaRequestDeviceParams::GetDeviceTrack() {
96 OmahaRequestDeviceParams params;
97 // Note that params.app_track is an empty string if the value in
98 // lsb-release file is invalid. See Init() for details.
99 return params.Init("", "") ? params.app_track : "";
100 }
101
95 string OmahaRequestDeviceParams::GetLsbValue(const string& key, 102 string OmahaRequestDeviceParams::GetLsbValue(const string& key,
96 const string& default_value, 103 const string& default_value,
97 ValueValidator validator) const { 104 ValueValidator validator) const {
98 string files[] = {string(utils::kStatefulPartition) + "/etc/lsb-release", 105 string files[] = {string(utils::kStatefulPartition) + "/etc/lsb-release",
99 "/etc/lsb-release"}; 106 "/etc/lsb-release"};
100 for (unsigned int i = 0; i < arraysize(files); ++i) { 107 for (unsigned int i = 0; i < arraysize(files); ++i) {
101 // TODO(adlr): make sure files checked are owned as root (and all 108 // TODO(adlr): make sure files checked are owned as root (and all
102 // their parents are recursively, too). 109 // their parents are recursively, too).
103 string file_data; 110 string file_data;
104 if (!utils::ReadFileToString(root_ + files[i], &file_data)) 111 if (!utils::ReadFileToString(root_ + files[i], &file_data))
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 return IsOfficialBuild() ? 150 return IsOfficialBuild() ?
144 (track == "beta-channel" || track == "dev-channel") : true; 151 (track == "beta-channel" || track == "dev-channel") : true;
145 } 152 }
146 153
147 void OmahaRequestDeviceParams::SetBuildTypeOfficial(bool is_official) { 154 void OmahaRequestDeviceParams::SetBuildTypeOfficial(bool is_official) {
148 force_build_type_ = true; 155 force_build_type_ = true;
149 forced_official_build_ = is_official; 156 forced_official_build_ = is_official;
150 } 157 }
151 158
152 } // namespace chromeos_update_engine 159 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « omaha_request_params.h ('k') | update_engine.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698