| 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_UPDATE_ATTEMPTER_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_ATTEMPTER_H__ |
| 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_ATTEMPTER_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_ATTEMPTER_H__ |
| 7 | 7 |
| 8 #include <time.h> | 8 #include <time.h> |
| 9 | 9 |
| 10 #include <tr1/memory> | 10 #include <tr1/memory> |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 // This is the D-Bus service entry point for going through an | 81 // This is the D-Bus service entry point for going through an |
| 82 // update. If the current status is idle invokes Update. | 82 // update. If the current status is idle invokes Update. |
| 83 void CheckForUpdate(const std::string& app_version, | 83 void CheckForUpdate(const std::string& app_version, |
| 84 const std::string& omaha_url); | 84 const std::string& omaha_url); |
| 85 | 85 |
| 86 // Initiates a reboot if the current state is | 86 // Initiates a reboot if the current state is |
| 87 // UPDATED_NEED_REBOOT. Returns true on sucess, false otherwise. | 87 // UPDATED_NEED_REBOOT. Returns true on sucess, false otherwise. |
| 88 bool RebootIfNeeded(); | 88 bool RebootIfNeeded(); |
| 89 | 89 |
| 90 // DownloadActionDelegate method | 90 // DownloadActionDelegate methods |
| 91 void SetDownloadStatus(bool active); |
| 91 void BytesReceived(uint64_t bytes_received, uint64_t total); | 92 void BytesReceived(uint64_t bytes_received, uint64_t total); |
| 92 | 93 |
| 93 private: | 94 private: |
| 94 // Sets the status to the given status and notifies a status update | 95 // Sets the status to the given status and notifies a status update |
| 95 // over dbus. | 96 // over dbus. |
| 96 void SetStatusAndNotify(UpdateStatus status); | 97 void SetStatusAndNotify(UpdateStatus status); |
| 97 | 98 |
| 98 // Creates an error event object in |error_event_| to be included in | 99 // Creates an error event object in |error_event_| to be included in |
| 99 // an OmahaRequestAction once the current action processor is done. | 100 // an OmahaRequestAction once the current action processor is done. |
| 100 void CreatePendingErrorEvent(AbstractAction* action, ActionExitCode code); | 101 void CreatePendingErrorEvent(AbstractAction* action, ActionExitCode code); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 146 |
| 146 // Pending error event, if any. | 147 // Pending error event, if any. |
| 147 scoped_ptr<OmahaEvent> error_event_; | 148 scoped_ptr<OmahaEvent> error_event_; |
| 148 | 149 |
| 149 // Current process priority. | 150 // Current process priority. |
| 150 utils::ProcessPriority priority_; | 151 utils::ProcessPriority priority_; |
| 151 | 152 |
| 152 // The process priority management timeout source. | 153 // The process priority management timeout source. |
| 153 GSource* manage_priority_source_; | 154 GSource* manage_priority_source_; |
| 154 | 155 |
| 156 // Set to true if an update download is active (and BytesReceived |
| 157 // will be called), set to false otherwise. |
| 158 bool download_active_; |
| 159 |
| 155 // For status: | 160 // For status: |
| 156 UpdateStatus status_; | 161 UpdateStatus status_; |
| 157 double download_progress_; | 162 double download_progress_; |
| 158 int64_t last_checked_time_; | 163 int64_t last_checked_time_; |
| 159 std::string new_version_; | 164 std::string new_version_; |
| 160 int64_t new_size_; | 165 int64_t new_size_; |
| 161 | 166 |
| 162 // Device paramaters common to all Omaha requests. | 167 // Device paramaters common to all Omaha requests. |
| 163 OmahaRequestDeviceParams omaha_request_params_; | 168 OmahaRequestDeviceParams omaha_request_params_; |
| 164 | 169 |
| 165 DISALLOW_COPY_AND_ASSIGN(UpdateAttempter); | 170 DISALLOW_COPY_AND_ASSIGN(UpdateAttempter); |
| 166 }; | 171 }; |
| 167 | 172 |
| 168 } // namespace chromeos_update_engine | 173 } // namespace chromeos_update_engine |
| 169 | 174 |
| 170 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_ATTEMPTER_H__ | 175 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_ATTEMPTER_H__ |
| OLD | NEW |