| 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 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_PARAMS_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_PARAMS_H__ |
| 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_PARAMS_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_PARAMS_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 | 11 |
| 12 // This gathers local system information and prepares info used by the | 12 // This gathers local system information and prepares info used by the |
| 13 // Omaha request action. | 13 // Omaha request action. |
| 14 | 14 |
| 15 namespace chromeos_update_engine { | 15 namespace chromeos_update_engine { |
| 16 | 16 |
| 17 // This struct encapsulates the data Omaha gets for the request. | 17 // This struct encapsulates the data Omaha gets for the request. |
| 18 // These strings in this struct should not be XML escaped. | 18 // These strings in this struct should not be XML escaped. |
| 19 struct OmahaRequestParams { | 19 struct OmahaRequestParams { |
| 20 OmahaRequestParams() | 20 OmahaRequestParams() |
| 21 : os_platform(kOsPlatform), os_version(kOsVersion), app_id(kAppId) {} | 21 : os_platform(kOsPlatform), os_version(kOsVersion), app_id(kAppId) {} |
| 22 OmahaRequestParams(const std::string& in_machine_id, | 22 OmahaRequestParams(const std::string& in_os_platform, |
| 23 const std::string& in_user_id, | |
| 24 const std::string& in_os_platform, | |
| 25 const std::string& in_os_version, | 23 const std::string& in_os_version, |
| 26 const std::string& in_os_sp, | 24 const std::string& in_os_sp, |
| 27 const std::string& in_os_board, | 25 const std::string& in_os_board, |
| 28 const std::string& in_app_id, | 26 const std::string& in_app_id, |
| 29 const std::string& in_app_version, | 27 const std::string& in_app_version, |
| 30 const std::string& in_app_lang, | 28 const std::string& in_app_lang, |
| 31 const std::string& in_app_track, | 29 const std::string& in_app_track, |
| 32 const bool in_delta_okay, | 30 const bool in_delta_okay, |
| 33 const std::string& in_update_url) | 31 const std::string& in_update_url) |
| 34 : machine_id(in_machine_id), | 32 : os_platform(in_os_platform), |
| 35 user_id(in_user_id), | |
| 36 os_platform(in_os_platform), | |
| 37 os_version(in_os_version), | 33 os_version(in_os_version), |
| 38 os_sp(in_os_sp), | 34 os_sp(in_os_sp), |
| 39 os_board(in_os_board), | 35 os_board(in_os_board), |
| 40 app_id(in_app_id), | 36 app_id(in_app_id), |
| 41 app_version(in_app_version), | 37 app_version(in_app_version), |
| 42 app_lang(in_app_lang), | 38 app_lang(in_app_lang), |
| 43 app_track(in_app_track), | 39 app_track(in_app_track), |
| 44 delta_okay(in_delta_okay), | 40 delta_okay(in_delta_okay), |
| 45 update_url(in_update_url) {} | 41 update_url(in_update_url) {} |
| 46 | 42 |
| 47 std::string machine_id; | |
| 48 std::string user_id; | |
| 49 std::string os_platform; | 43 std::string os_platform; |
| 50 std::string os_version; | 44 std::string os_version; |
| 51 std::string os_sp; | 45 std::string os_sp; |
| 52 std::string os_board; | 46 std::string os_board; |
| 53 std::string app_id; | 47 std::string app_id; |
| 54 std::string app_version; | 48 std::string app_version; |
| 55 std::string app_lang; | 49 std::string app_lang; |
| 56 std::string app_track; | 50 std::string app_track; |
| 57 bool delta_okay; // If this client can accept a delta | 51 bool delta_okay; // If this client can accept a delta |
| 58 | 52 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 72 // Initializes all the data in the object. Non-empty | 66 // Initializes all the data in the object. Non-empty |
| 73 // |in_app_version| or |in_update_url| prevents automatic detection | 67 // |in_app_version| or |in_update_url| prevents automatic detection |
| 74 // of the parameter. Returns true on success, false otherwise. | 68 // of the parameter. Returns true on success, false otherwise. |
| 75 bool Init(const std::string& in_app_version, | 69 bool Init(const std::string& in_app_version, |
| 76 const std::string& in_update_url); | 70 const std::string& in_update_url); |
| 77 | 71 |
| 78 // For unit-tests. | 72 // For unit-tests. |
| 79 void set_root(const std::string& root) { root_ = root; } | 73 void set_root(const std::string& root) { root_ = root; } |
| 80 | 74 |
| 81 private: | 75 private: |
| 82 // Gets a machine-local ID (for now, first MAC address we find). | |
| 83 bool GetMachineId(std::string* out_id) const; | |
| 84 | |
| 85 // Fetches the value for a given key from | 76 // Fetches the value for a given key from |
| 86 // /mnt/stateful_partition/etc/lsb-release if possible. Failing that, | 77 // /mnt/stateful_partition/etc/lsb-release if possible. Failing that, |
| 87 // it looks for the key in /etc/lsb-release. | 78 // it looks for the key in /etc/lsb-release. |
| 88 std::string GetLsbValue(const std::string& key, | 79 std::string GetLsbValue(const std::string& key, |
| 89 const std::string& default_value) const; | 80 const std::string& default_value) const; |
| 90 | 81 |
| 91 // Gets the machine type (e.g. "i686"). | 82 // Gets the machine type (e.g. "i686"). |
| 92 std::string GetMachineType() const; | 83 std::string GetMachineType() const; |
| 93 | 84 |
| 94 // When reading files, prepend root_ to the paths. Useful for testing. | 85 // When reading files, prepend root_ to the paths. Useful for testing. |
| 95 std::string root_; | 86 std::string root_; |
| 96 | 87 |
| 97 DISALLOW_COPY_AND_ASSIGN(OmahaRequestDeviceParams); | 88 DISALLOW_COPY_AND_ASSIGN(OmahaRequestDeviceParams); |
| 98 }; | 89 }; |
| 99 | 90 |
| 100 } // namespace chromeos_update_engine | 91 } // namespace chromeos_update_engine |
| 101 | 92 |
| 102 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_PARAMS_H__ | 93 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_PARAMS_H__ |
| OLD | NEW |