| 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_os_platform, | 22 OmahaRequestParams(const std::string& in_os_platform, |
| 23 const std::string& in_os_version, | 23 const std::string& in_os_version, |
| 24 const std::string& in_os_sp, | 24 const std::string& in_os_sp, |
| 25 const std::string& in_os_board, | 25 const std::string& in_os_board, |
| 26 const std::string& in_app_id, | 26 const std::string& in_app_id, |
| 27 const std::string& in_app_version, | 27 const std::string& in_app_version, |
| 28 const std::string& in_app_lang, | 28 const std::string& in_app_lang, |
| 29 const std::string& in_app_track, | 29 const std::string& in_app_track, |
| 30 const std::string& in_hardware_class, |
| 30 const bool in_delta_okay, | 31 const bool in_delta_okay, |
| 31 const std::string& in_update_url) | 32 const std::string& in_update_url) |
| 32 : os_platform(in_os_platform), | 33 : os_platform(in_os_platform), |
| 33 os_version(in_os_version), | 34 os_version(in_os_version), |
| 34 os_sp(in_os_sp), | 35 os_sp(in_os_sp), |
| 35 os_board(in_os_board), | 36 os_board(in_os_board), |
| 36 app_id(in_app_id), | 37 app_id(in_app_id), |
| 37 app_version(in_app_version), | 38 app_version(in_app_version), |
| 38 app_lang(in_app_lang), | 39 app_lang(in_app_lang), |
| 39 app_track(in_app_track), | 40 app_track(in_app_track), |
| 41 hardware_class(in_hardware_class), |
| 40 delta_okay(in_delta_okay), | 42 delta_okay(in_delta_okay), |
| 41 update_url(in_update_url) {} | 43 update_url(in_update_url) {} |
| 42 | 44 |
| 43 std::string os_platform; | 45 std::string os_platform; |
| 44 std::string os_version; | 46 std::string os_version; |
| 45 std::string os_sp; | 47 std::string os_sp; |
| 46 std::string os_board; | 48 std::string os_board; |
| 47 std::string app_id; | 49 std::string app_id; |
| 48 std::string app_version; | 50 std::string app_version; |
| 49 std::string app_lang; | 51 std::string app_lang; |
| 50 std::string app_track; | 52 std::string app_track; |
| 53 std::string hardware_class; // Hardware Qualification ID of the client |
| 51 bool delta_okay; // If this client can accept a delta | 54 bool delta_okay; // If this client can accept a delta |
| 52 | 55 |
| 53 std::string update_url; | 56 std::string update_url; |
| 54 | 57 |
| 55 // Suggested defaults | 58 // Suggested defaults |
| 56 static const char* const kAppId; | 59 static const char* const kAppId; |
| 57 static const char* const kOsPlatform; | 60 static const char* const kOsPlatform; |
| 58 static const char* const kOsVersion; | 61 static const char* const kOsVersion; |
| 59 static const char* const kUpdateUrl; | 62 static const char* const kUpdateUrl; |
| 60 }; | 63 }; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 75 private: | 78 private: |
| 76 // Fetches the value for a given key from | 79 // Fetches the value for a given key from |
| 77 // /mnt/stateful_partition/etc/lsb-release if possible. Failing that, | 80 // /mnt/stateful_partition/etc/lsb-release if possible. Failing that, |
| 78 // it looks for the key in /etc/lsb-release. | 81 // it looks for the key in /etc/lsb-release. |
| 79 std::string GetLsbValue(const std::string& key, | 82 std::string GetLsbValue(const std::string& key, |
| 80 const std::string& default_value) const; | 83 const std::string& default_value) const; |
| 81 | 84 |
| 82 // Gets the machine type (e.g. "i686"). | 85 // Gets the machine type (e.g. "i686"). |
| 83 std::string GetMachineType() const; | 86 std::string GetMachineType() const; |
| 84 | 87 |
| 88 // Returns the hardware qualification ID of the system, or empty |
| 89 // string if the HWID is unavailable. |
| 90 std::string GetHardwareClass() const; |
| 91 |
| 85 // When reading files, prepend root_ to the paths. Useful for testing. | 92 // When reading files, prepend root_ to the paths. Useful for testing. |
| 86 std::string root_; | 93 std::string root_; |
| 87 | 94 |
| 88 DISALLOW_COPY_AND_ASSIGN(OmahaRequestDeviceParams); | 95 DISALLOW_COPY_AND_ASSIGN(OmahaRequestDeviceParams); |
| 89 }; | 96 }; |
| 90 | 97 |
| 91 } // namespace chromeos_update_engine | 98 } // namespace chromeos_update_engine |
| 92 | 99 |
| 93 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_PARAMS_H__ | 100 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_PARAMS_H__ |
| OLD | NEW |