Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: chromeos/dbus/update_engine_client.h

Issue 17437004: Implemented new channel switcher UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix, sync. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "chromeos/dbus/dbus_client_implementation_type.h" 11 #include "chromeos/dbus/dbus_client_implementation_type.h"
12 12
13 #include <string> 13 #include <string>
14 14
15 namespace dbus { 15 namespace dbus {
16 class Bus; 16 class Bus;
17 } // namespace 17 }
18 18
19 namespace chromeos { 19 namespace chromeos {
20 20
21 // UpdateEngineClient is used to communicate with the update engine. 21 // UpdateEngineClient is used to communicate with the update engine.
22 class CHROMEOS_EXPORT UpdateEngineClient { 22 class CHROMEOS_EXPORT UpdateEngineClient {
23 public: 23 public:
24 // Edges for state machine 24 // Edges for state machine
25 // IDLE->CHECKING_FOR_UPDATE 25 // IDLE->CHECKING_FOR_UPDATE
26 // CHECKING_FOR_UPDATE->IDLE 26 // CHECKING_FOR_UPDATE->IDLE
27 // CHECKING_FOR_UPDATE->UPDATE_AVAILABLE 27 // CHECKING_FOR_UPDATE->UPDATE_AVAILABLE
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(const 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 // DEPRECATED: Use SetChannel instead.
90 // Requests to set the release track (channel). |track| should look like 91 // Requests to set the release track (channel). |track| should look like
91 // "beta-channel" or "dev-channel". 92 // "beta-channel" or "dev-channel".
92 virtual void SetReleaseTrack(const std::string& track) = 0; 93 virtual void SetReleaseTrack(const std::string& track) = 0;
93 94
94 // Called once GetReleaseTrack() is complete. Takes one parameter; 95 // Called once GetReleaseTrack() is complete. Takes one parameter;
95 // - string: the release track name like "beta-channel". 96 // - string: the release track name like "beta-channel".
96 typedef base::Callback<void(const std::string&)> GetReleaseTrackCallback; 97 typedef base::Callback<void(const std::string&)> GetReleaseTrackCallback;
97 98
99 // Called once GetChannel() is complete. Takes one parameter;
100 // - string: the channel name like "beta-channel".
101 typedef base::Callback<void(const std::string&)> GetChannelCallback;
satorux1 2013/06/24 17:21:12 Please add a parameter name: typedef base::Callba
ygorshenin1 2013/06/24 17:50:35 Done.
102
103 // DEPRECATED: Use GetChannel() instead.
98 // Requests to get the release track and calls |callback| with the 104 // Requests to get the release track and calls |callback| with the
99 // release track (channel). On error, calls |callback| with an empty 105 // release track (channel). On error, calls |callback| with an empty
100 // string. 106 // string.
101 virtual void GetReleaseTrack(const GetReleaseTrackCallback& callback) = 0; 107 virtual void GetReleaseTrack(const GetReleaseTrackCallback& callback) = 0;
102 108
103 // Returns the last status the object received from the update engine. 109 // Returns the last status the object received from the update engine.
104 // 110 //
105 // Ideally, the D-Bus client should be state-less, but there are clients 111 // Ideally, the D-Bus client should be state-less, but there are clients
106 // that need this information. 112 // that need this information.
107 virtual Status GetLastStatus() = 0; 113 virtual Status GetLastStatus() = 0;
108 114
115 // Changes the current channel of the device to the target
116 // channel. If the target channel is a less stable channel than the
117 // current channel, then the channel change happens immediately (at
118 // the next update check). If the target channel is a more stable
119 // channel, then if |is_powerwash_allowed| is set to true, then also
120 // the change happens immediately but with a powerwash if
121 // required. Otherwise, the change takes effect eventually (when the
122 // version on the target channel goes above the version number of
123 // what the device currently has). |target_channel| should look like
124 // "dev-channel", "beta-channel" or "stable-channel".
125 virtual void SetChannel(const std::string& target_channel,
126 bool is_powerwash_allowed) = 0;
satorux1 2013/06/24 17:21:12 boolean parameters like this often make callers ha
ygorshenin1 2013/06/24 17:50:35 We're planning to introduce an enum instead of str
127
128 // If |get_current_channel| is set to true, calls |callback| with
129 // the name of the channel that the device is currently
130 // on. Otherwise, it calls it with the name of the channel the
131 // device is supposed to be (in case of a pending channel
132 // change). On error, calls |callback| with an empty string.
133 virtual void GetChannel(bool get_current_channel,
134 const GetChannelCallback& callback) = 0;
135
109 // Returns an empty UpdateCheckCallback that does nothing. 136 // Returns an empty UpdateCheckCallback that does nothing.
110 static UpdateCheckCallback EmptyUpdateCheckCallback(); 137 static UpdateCheckCallback EmptyUpdateCheckCallback();
111 138
112 // Creates the instance. 139 // Creates the instance.
113 static UpdateEngineClient* Create(DBusClientImplementationType type, 140 static UpdateEngineClient* Create(DBusClientImplementationType type,
114 dbus::Bus* bus); 141 dbus::Bus* bus);
115 142
116 protected: 143 protected:
117 // Create() should be used instead. 144 // Create() should be used instead.
118 UpdateEngineClient(); 145 UpdateEngineClient();
119 146
120 private: 147 private:
121 DISALLOW_COPY_AND_ASSIGN(UpdateEngineClient); 148 DISALLOW_COPY_AND_ASSIGN(UpdateEngineClient);
122 }; 149 };
123 150
124 } // namespace chromeos 151 } // namespace chromeos
125 152
126 #endif // CHROMEOS_DBUS_UPDATE_ENGINE_CLIENT_H_ 153 #endif // CHROMEOS_DBUS_UPDATE_ENGINE_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698