OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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_DBUS_UPDATE_ENGINE_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_UPDATE_ENGINE_CLIENT_H_ |
6 #define CHROMEOS_DBUS_UPDATE_ENGINE_CLIENT_H_ | 6 #define CHROMEOS_DBUS_UPDATE_ENGINE_CLIENT_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "chromeos/chromeos_export.h" | 10 #include "chromeos/chromeos_export.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 virtual void AddObserver(Observer* observer) = 0; | 75 virtual void AddObserver(Observer* observer) = 0; |
76 virtual void RemoveObserver(Observer* observer) = 0; | 76 virtual void RemoveObserver(Observer* observer) = 0; |
77 // Returns true if this object has the given observer. | 77 // Returns true if this object has the given observer. |
78 virtual bool HasObserver(Observer* observer) = 0; | 78 virtual bool HasObserver(Observer* observer) = 0; |
79 | 79 |
80 // Called once RequestUpdateCheck() is complete. Takes one parameter: | 80 // Called once RequestUpdateCheck() is complete. Takes one parameter: |
81 // - UpdateCheckResult: the result of the update check. | 81 // - UpdateCheckResult: the result of the update check. |
82 typedef base::Callback<void(UpdateCheckResult)> UpdateCheckCallback; | 82 typedef base::Callback<void(UpdateCheckResult)> UpdateCheckCallback; |
83 | 83 |
84 // Requests an update check and calls |callback| when completed. | 84 // Requests an update check and calls |callback| when completed. |
85 virtual void RequestUpdateCheck(UpdateCheckCallback callback) = 0; | 85 virtual void RequestUpdateCheck(const UpdateCheckCallback& callback) = 0; |
86 | 86 |
87 // Reboots if update has been performed. | 87 // Reboots if update has been performed. |
88 virtual void RebootAfterUpdate() = 0; | 88 virtual void RebootAfterUpdate() = 0; |
89 | 89 |
90 // Requests to set the release track (channel). |track| should look like | 90 // Requests to set the release track (channel). |track| should look like |
91 // "beta-channel" or "dev-channel". | 91 // "beta-channel" or "dev-channel". |
92 virtual void SetReleaseTrack(const std::string& track) = 0; | 92 virtual void SetReleaseTrack(const std::string& track) = 0; |
93 | 93 |
94 // Called once GetReleaseTrack() is complete. Takes one parameter; | 94 // Called once GetReleaseTrack() is complete. Takes one parameter; |
95 // - string: the release track name like "beta-channel". | 95 // - string: the release track name like "beta-channel". |
96 typedef base::Callback<void(const std::string&)> GetReleaseTrackCallback; | 96 typedef base::Callback<void(const std::string&)> GetReleaseTrackCallback; |
97 | 97 |
98 // Requests to get the release track and calls |callback| with the | 98 // Requests to get the release track and calls |callback| with the |
99 // release track (channel). On error, calls |callback| with an empty | 99 // release track (channel). On error, calls |callback| with an empty |
100 // string. | 100 // string. |
101 virtual void GetReleaseTrack(GetReleaseTrackCallback callback) = 0; | 101 virtual void GetReleaseTrack(const GetReleaseTrackCallback& callback) = 0; |
102 | 102 |
103 // Returns the last status the object received from the update engine. | 103 // Returns the last status the object received from the update engine. |
104 // | 104 // |
105 // Ideally, the D-Bus client should be state-less, but there are clients | 105 // Ideally, the D-Bus client should be state-less, but there are clients |
106 // that need this information. | 106 // that need this information. |
107 virtual Status GetLastStatus() = 0; | 107 virtual Status GetLastStatus() = 0; |
108 | 108 |
109 // Returns an empty UpdateCheckCallback that does nothing. | 109 // Returns an empty UpdateCheckCallback that does nothing. |
110 static UpdateCheckCallback EmptyUpdateCheckCallback(); | 110 static UpdateCheckCallback EmptyUpdateCheckCallback(); |
111 | 111 |
112 // Creates the instance. | 112 // Creates the instance. |
113 static UpdateEngineClient* Create(DBusClientImplementationType type, | 113 static UpdateEngineClient* Create(DBusClientImplementationType type, |
114 dbus::Bus* bus); | 114 dbus::Bus* bus); |
115 | 115 |
116 protected: | 116 protected: |
117 // Create() should be used instead. | 117 // Create() should be used instead. |
118 UpdateEngineClient(); | 118 UpdateEngineClient(); |
119 | 119 |
120 private: | 120 private: |
121 DISALLOW_COPY_AND_ASSIGN(UpdateEngineClient); | 121 DISALLOW_COPY_AND_ASSIGN(UpdateEngineClient); |
122 }; | 122 }; |
123 | 123 |
124 } // namespace chromeos | 124 } // namespace chromeos |
125 | 125 |
126 #endif // CHROMEOS_DBUS_UPDATE_ENGINE_CLIENT_H_ | 126 #endif // CHROMEOS_DBUS_UPDATE_ENGINE_CLIENT_H_ |
OLD | NEW |