| 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_RESPONSE_HANDLER_ACTION_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_RESPONSE_HANDLER_ACTION_H__ |
| 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_RESPONSE_HANDLER_ACTION_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_RESPONSE_HANDLER_ACTION_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include "update_engine/action.h" | 9 #include "update_engine/action.h" |
| 10 #include "update_engine/install_plan.h" | 10 #include "update_engine/install_plan.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class ActionTraits<OmahaResponseHandlerAction> { | 22 class ActionTraits<OmahaResponseHandlerAction> { |
| 23 public: | 23 public: |
| 24 typedef OmahaResponse InputObjectType; | 24 typedef OmahaResponse InputObjectType; |
| 25 typedef InstallPlan OutputObjectType; | 25 typedef InstallPlan OutputObjectType; |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 class OmahaResponseHandlerAction : public Action<OmahaResponseHandlerAction> { | 28 class OmahaResponseHandlerAction : public Action<OmahaResponseHandlerAction> { |
| 29 public: | 29 public: |
| 30 static const char kDeadlineFile[]; | 30 static const char kDeadlineFile[]; |
| 31 | 31 |
| 32 OmahaResponseHandlerAction(PrefsInterface* prefs) | 32 OmahaResponseHandlerAction(PrefsInterface* prefs); |
| 33 : prefs_(prefs), | |
| 34 got_no_update_response_(false) {} | |
| 35 typedef ActionTraits<OmahaResponseHandlerAction>::InputObjectType | 33 typedef ActionTraits<OmahaResponseHandlerAction>::InputObjectType |
| 36 InputObjectType; | 34 InputObjectType; |
| 37 typedef ActionTraits<OmahaResponseHandlerAction>::OutputObjectType | 35 typedef ActionTraits<OmahaResponseHandlerAction>::OutputObjectType |
| 38 OutputObjectType; | 36 OutputObjectType; |
| 39 void PerformAction(); | 37 void PerformAction(); |
| 40 | 38 |
| 41 // This is a synchronous action, and thus TerminateProcessing() should | 39 // This is a synchronous action, and thus TerminateProcessing() should |
| 42 // never be called | 40 // never be called |
| 43 void TerminateProcessing() { CHECK(false); } | 41 void TerminateProcessing() { CHECK(false); } |
| 44 | 42 |
| 45 // For unit-testing | 43 // For unit-testing |
| 46 void set_boot_device(const std::string& boot_device) { | 44 void set_boot_device(const std::string& boot_device) { |
| 47 boot_device_ = boot_device; | 45 boot_device_ = boot_device; |
| 48 } | 46 } |
| 49 | 47 |
| 50 bool GotNoUpdateResponse() const { return got_no_update_response_; } | 48 bool GotNoUpdateResponse() const { return got_no_update_response_; } |
| 51 const InstallPlan& install_plan() const { return install_plan_; } | 49 const InstallPlan& install_plan() const { return install_plan_; } |
| 52 | 50 |
| 53 // Debugging/logging | 51 // Debugging/logging |
| 54 static std::string StaticType() { return "OmahaResponseHandlerAction"; } | 52 static std::string StaticType() { return "OmahaResponseHandlerAction"; } |
| 55 std::string Type() const { return StaticType(); } | 53 std::string Type() const { return StaticType(); } |
| 54 void set_key_path(const std::string& path) { key_path_ = path; } |
| 56 | 55 |
| 57 private: | 56 private: |
| 58 // Assumes you want to install on the "other" device, where the other | 57 // Assumes you want to install on the "other" device, where the other |
| 59 // device is what you get if you swap 1 for 2 or 3 for 4 or vice versa | 58 // device is what you get if you swap 1 for 2 or 3 for 4 or vice versa |
| 60 // for the number at the end of the boot device. E.g., /dev/sda1 -> /dev/sda2 | 59 // for the number at the end of the boot device. E.g., /dev/sda1 -> /dev/sda2 |
| 61 // or /dev/sda4 -> /dev/sda3 | 60 // or /dev/sda4 -> /dev/sda3 |
| 62 static bool GetInstallDev(const std::string& boot_dev, | 61 static bool GetInstallDev(const std::string& boot_dev, |
| 63 std::string* install_dev); | 62 std::string* install_dev); |
| 64 | 63 |
| 65 // Update Engine preference store. | 64 // Update Engine preference store. |
| 66 PrefsInterface* prefs_; | 65 PrefsInterface* prefs_; |
| 67 | 66 |
| 68 // set to non-empty in unit tests | 67 // set to non-empty in unit tests |
| 69 std::string boot_device_; | 68 std::string boot_device_; |
| 70 | 69 |
| 71 // The install plan, if we have an update. | 70 // The install plan, if we have an update. |
| 72 InstallPlan install_plan_; | 71 InstallPlan install_plan_; |
| 73 | 72 |
| 74 // True only if we got a response and the response said no updates | 73 // True only if we got a response and the response said no updates |
| 75 bool got_no_update_response_; | 74 bool got_no_update_response_; |
| 76 | 75 |
| 76 // Public key path to use for payload verification. |
| 77 std::string key_path_; |
| 78 |
| 77 DISALLOW_COPY_AND_ASSIGN(OmahaResponseHandlerAction); | 79 DISALLOW_COPY_AND_ASSIGN(OmahaResponseHandlerAction); |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 } // namespace chromeos_update_engine | 82 } // namespace chromeos_update_engine |
| 81 | 83 |
| 82 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_RESPONSE_HANDLER_ACTION_H__ | 84 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_RESPONSE_HANDLER_ACTION_H__ |
| OLD | NEW |