| 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" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 // Suggested defaults | 61 // Suggested defaults |
| 62 static const char* const kAppId; | 62 static const char* const kAppId; |
| 63 static const char* const kOsPlatform; | 63 static const char* const kOsPlatform; |
| 64 static const char* const kOsVersion; | 64 static const char* const kOsVersion; |
| 65 static const char* const kUpdateUrl; | 65 static const char* const kUpdateUrl; |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 class OmahaRequestDeviceParams : public OmahaRequestParams { | 68 class OmahaRequestDeviceParams : public OmahaRequestParams { |
| 69 public: | 69 public: |
| 70 explicit OmahaRequestDeviceParams() {} | 70 OmahaRequestDeviceParams() {} |
| 71 | 71 |
| 72 // Initializes all the data in the object. Returns true on success, | 72 // Initializes all the data in the object. Non-empty |
| 73 // false otherwise. | 73 // |in_app_version| or |in_update_url| prevents automatic detection |
| 74 bool Init(); | 74 // of the parameter. Returns true on success, false otherwise. |
| 75 bool Init(const std::string& in_app_version, |
| 76 const std::string& in_update_url); |
| 75 | 77 |
| 76 // For unit-tests. | 78 // For unit-tests. |
| 77 void set_root(const std::string& root) { root_ = root; } | 79 void set_root(const std::string& root) { root_ = root; } |
| 78 | 80 |
| 79 private: | 81 private: |
| 80 // Gets a machine-local ID (for now, first MAC address we find). | 82 // Gets a machine-local ID (for now, first MAC address we find). |
| 81 bool GetMachineId(std::string* out_id) const; | 83 bool GetMachineId(std::string* out_id) const; |
| 82 | 84 |
| 83 // Fetches the value for a given key from | 85 // Fetches the value for a given key from |
| 84 // /mnt/stateful_partition/etc/lsb-release if possible. Failing that, | 86 // /mnt/stateful_partition/etc/lsb-release if possible. Failing that, |
| 85 // it looks for the key in /etc/lsb-release. | 87 // it looks for the key in /etc/lsb-release. |
| 86 std::string GetLsbValue(const std::string& key, | 88 std::string GetLsbValue(const std::string& key, |
| 87 const std::string& default_value) const; | 89 const std::string& default_value) const; |
| 88 | 90 |
| 89 // Gets the machine type (e.g. "i686"). | 91 // Gets the machine type (e.g. "i686"). |
| 90 std::string GetMachineType() const; | 92 std::string GetMachineType() const; |
| 91 | 93 |
| 92 // When reading files, prepend root_ to the paths. Useful for testing. | 94 // When reading files, prepend root_ to the paths. Useful for testing. |
| 93 std::string root_; | 95 std::string root_; |
| 94 | 96 |
| 95 DISALLOW_COPY_AND_ASSIGN(OmahaRequestDeviceParams); | 97 DISALLOW_COPY_AND_ASSIGN(OmahaRequestDeviceParams); |
| 96 }; | 98 }; |
| 97 | 99 |
| 98 } // namespace chromeos_update_engine | 100 } // namespace chromeos_update_engine |
| 99 | 101 |
| 100 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_PARAMS_H__ | 102 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_REQUEST_PARAMS_H__ |
| OLD | NEW |