OLD | NEW |
1 // Copyright (c) 2009 The Chromium 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" |
11 #include "update_engine/omaha_request_action.h" | 11 #include "update_engine/omaha_request_action.h" |
12 | 12 |
13 // This class reads in an Omaha response and converts what it sees into | 13 // This class reads in an Omaha response and converts what it sees into |
14 // an install plan which is passed out. | 14 // an install plan which is passed out. |
15 | 15 |
16 namespace chromeos_update_engine { | 16 namespace chromeos_update_engine { |
17 | 17 |
18 class OmahaResponseHandlerAction; | 18 class OmahaResponseHandlerAction; |
| 19 class PrefsInterface; |
19 | 20 |
20 template<> | 21 template<> |
21 class ActionTraits<OmahaResponseHandlerAction> { | 22 class ActionTraits<OmahaResponseHandlerAction> { |
22 public: | 23 public: |
23 typedef OmahaResponse InputObjectType; | 24 typedef OmahaResponse InputObjectType; |
24 typedef InstallPlan OutputObjectType; | 25 typedef InstallPlan OutputObjectType; |
25 }; | 26 }; |
26 | 27 |
27 class OmahaResponseHandlerAction : public Action<OmahaResponseHandlerAction> { | 28 class OmahaResponseHandlerAction : public Action<OmahaResponseHandlerAction> { |
28 public: | 29 public: |
29 OmahaResponseHandlerAction() : got_no_update_response_(false) {} | 30 OmahaResponseHandlerAction(PrefsInterface* prefs) |
| 31 : prefs_(prefs), |
| 32 got_no_update_response_(false) {} |
30 typedef ActionTraits<OmahaResponseHandlerAction>::InputObjectType | 33 typedef ActionTraits<OmahaResponseHandlerAction>::InputObjectType |
31 InputObjectType; | 34 InputObjectType; |
32 typedef ActionTraits<OmahaResponseHandlerAction>::OutputObjectType | 35 typedef ActionTraits<OmahaResponseHandlerAction>::OutputObjectType |
33 OutputObjectType; | 36 OutputObjectType; |
34 void PerformAction(); | 37 void PerformAction(); |
35 | 38 |
36 // This is a synchronous action, and thus TerminateProcessing() should | 39 // This is a synchronous action, and thus TerminateProcessing() should |
37 // never be called | 40 // never be called |
38 void TerminateProcessing() { CHECK(false); } | 41 void TerminateProcessing() { CHECK(false); } |
39 | 42 |
(...skipping 10 matching lines...) Expand all Loading... |
50 std::string Type() const { return StaticType(); } | 53 std::string Type() const { return StaticType(); } |
51 | 54 |
52 private: | 55 private: |
53 // Assumes you want to install on the "other" device, where the other | 56 // Assumes you want to install on the "other" device, where the other |
54 // device is what you get if you swap 1 for 2 or 3 for 4 or vice versa | 57 // device is what you get if you swap 1 for 2 or 3 for 4 or vice versa |
55 // for the number at the end of the boot device. E.g., /dev/sda1 -> /dev/sda2 | 58 // for the number at the end of the boot device. E.g., /dev/sda1 -> /dev/sda2 |
56 // or /dev/sda4 -> /dev/sda3 | 59 // or /dev/sda4 -> /dev/sda3 |
57 static bool GetInstallDev(const std::string& boot_dev, | 60 static bool GetInstallDev(const std::string& boot_dev, |
58 std::string* install_dev); | 61 std::string* install_dev); |
59 | 62 |
| 63 // Update Engine preference store. |
| 64 PrefsInterface* prefs_; |
| 65 |
60 // set to non-empty in unit tests | 66 // set to non-empty in unit tests |
61 std::string boot_device_; | 67 std::string boot_device_; |
62 | 68 |
63 // The install plan, if we have an update. | 69 // The install plan, if we have an update. |
64 InstallPlan install_plan_; | 70 InstallPlan install_plan_; |
65 | 71 |
66 // True only if we got a response and the response said no updates | 72 // True only if we got a response and the response said no updates |
67 bool got_no_update_response_; | 73 bool got_no_update_response_; |
68 | 74 |
69 DISALLOW_COPY_AND_ASSIGN(OmahaResponseHandlerAction); | 75 DISALLOW_COPY_AND_ASSIGN(OmahaResponseHandlerAction); |
70 }; | 76 }; |
71 | 77 |
72 } // namespace chromeos_update_engine | 78 } // namespace chromeos_update_engine |
73 | 79 |
74 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_RESPONSE_HANDLER_ACTION_H__ | 80 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_OMAHA_RESPONSE_HANDLER_ACTION_H__ |
OLD | NEW |