OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium 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_prep_action.h" | 5 #include "update_engine/omaha_request_prep_action.h" |
6 #include <sys/utsname.h> | 6 #include <sys/utsname.h> |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 string machine_id; | 32 string machine_id; |
33 TEST_AND_RETURN(GetMachineId(&machine_id)); | 33 TEST_AND_RETURN(GetMachineId(&machine_id)); |
34 const string version(GetLsbValue("CHROMEOS_RELEASE_VERSION", "")); | 34 const string version(GetLsbValue("CHROMEOS_RELEASE_VERSION", "")); |
35 const string sp(version + "_" + GetMachineType()); | 35 const string sp(version + "_" + GetMachineType()); |
36 const string track(GetLsbValue("CHROMEOS_RELEASE_TRACK", "")); | 36 const string track(GetLsbValue("CHROMEOS_RELEASE_TRACK", "")); |
37 const string update_url(GetLsbValue("CHROMEOS_AUSERVER", | 37 const string update_url(GetLsbValue("CHROMEOS_AUSERVER", |
38 OmahaRequestParams::kUpdateUrl)); | 38 OmahaRequestParams::kUpdateUrl)); |
39 const string board(GetLsbValue("CHROMEOS_RELEASE_BOARD", "")); | 39 const string board(GetLsbValue("CHROMEOS_RELEASE_BOARD", "")); |
40 | 40 |
41 OmahaRequestParams out(machine_id, // machine_id | 41 OmahaRequestParams out(machine_id, // machine_id |
42 machine_id, // user_id (use machine_id) | 42 machine_id, // user_id (use machine_id) |
43 OmahaRequestParams::kOsPlatform, | 43 OmahaRequestParams::kOsPlatform, |
44 OmahaRequestParams::kOsVersion, | 44 OmahaRequestParams::kOsVersion, |
45 sp, // e.g. 0.2.3.3_i686 | 45 sp, // e.g. 0.2.3.3_i686 |
46 board, // e.g. x86-generic | 46 board, // e.g. x86-generic |
47 OmahaRequestParams::kAppId, | 47 OmahaRequestParams::kAppId, |
48 version, // app version (from lsb-release) | 48 version, // app version (from lsb-release) |
49 "en-US", // lang | 49 "en-US", // lang |
50 track, // track | 50 track, // track |
51 update_url); | 51 update_url); |
52 | 52 |
53 CHECK(HasOutputPipe()); | 53 CHECK(HasOutputPipe()); |
54 SetOutputObject(out); | 54 SetOutputObject(out); |
55 completer.set_success(true); | 55 completer.set_success(true); |
56 } | 56 } |
57 | 57 |
58 namespace { | 58 namespace { |
59 const size_t kGuidDataByteLength = 128 / 8; | 59 const size_t kGuidDataByteLength = 128 / 8; |
60 const string::size_type kGuidStringLength = 38; | 60 const string::size_type kGuidStringLength = 38; |
61 // Formats 16 bytes (128 bits) of data as a GUID: | 61 // Formats 16 bytes (128 bits) of data as a GUID: |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 string OmahaRequestPrepAction::GetMachineType() const { | 119 string OmahaRequestPrepAction::GetMachineType() const { |
120 struct utsname buf; | 120 struct utsname buf; |
121 string ret; | 121 string ret; |
122 if (uname(&buf) == 0) | 122 if (uname(&buf) == 0) |
123 ret = buf.machine; | 123 ret = buf.machine; |
124 return ret; | 124 return ret; |
125 } | 125 } |
126 | 126 |
127 } // namespace chromeos_update_engine | 127 } // namespace chromeos_update_engine |
OLD | NEW |