| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // Initiates a reboot if the current state is | 108 // Initiates a reboot if the current state is |
| 109 // UPDATED_NEED_REBOOT. Returns true on sucess, false otherwise. | 109 // UPDATED_NEED_REBOOT. Returns true on sucess, false otherwise. |
| 110 bool RebootIfNeeded(); | 110 bool RebootIfNeeded(); |
| 111 | 111 |
| 112 // DownloadActionDelegate methods | 112 // DownloadActionDelegate methods |
| 113 void SetDownloadStatus(bool active); | 113 void SetDownloadStatus(bool active); |
| 114 void BytesReceived(uint64_t bytes_received, uint64_t total); | 114 void BytesReceived(uint64_t bytes_received, uint64_t total); |
| 115 | 115 |
| 116 private: | 116 private: |
| 117 friend class UpdateAttempterTest; | 117 friend class UpdateAttempterTest; |
| 118 FRIEND_TEST(UpdateAttempterTest, ActionCompletedDownloadTest); |
| 119 FRIEND_TEST(UpdateAttempterTest, ActionCompletedErrorTest); |
| 120 FRIEND_TEST(UpdateAttempterTest, ActionCompletedOmahaRequestTest); |
| 118 FRIEND_TEST(UpdateAttempterTest, DisableDeltaUpdateIfNeededTest); | 121 FRIEND_TEST(UpdateAttempterTest, DisableDeltaUpdateIfNeededTest); |
| 119 FRIEND_TEST(UpdateAttempterTest, MarkDeltaUpdateFailureTest); | 122 FRIEND_TEST(UpdateAttempterTest, MarkDeltaUpdateFailureTest); |
| 123 FRIEND_TEST(UpdateAttempterTest, ScheduleErrorEventActionNoEventTest); |
| 124 FRIEND_TEST(UpdateAttempterTest, ScheduleErrorEventActionTest); |
| 120 FRIEND_TEST(UpdateAttempterTest, UpdateTest); | 125 FRIEND_TEST(UpdateAttempterTest, UpdateTest); |
| 121 | 126 |
| 122 // Sets the status to the given status and notifies a status update | 127 // Sets the status to the given status and notifies a status update |
| 123 // over dbus. | 128 // over dbus. |
| 124 void SetStatusAndNotify(UpdateStatus status); | 129 void SetStatusAndNotify(UpdateStatus status); |
| 125 | 130 |
| 126 // Sets up the download parameters after receiving the update check response. | 131 // Sets up the download parameters after receiving the update check response. |
| 127 void SetupDownload(); | 132 void SetupDownload(); |
| 128 | 133 |
| 129 // Creates an error event object in |error_event_| to be included in an | 134 // Creates an error event object in |error_event_| to be included in an |
| (...skipping 23 matching lines...) Expand all Loading... |
| 153 static gboolean StaticManagePriorityCallback(gpointer data); | 158 static gboolean StaticManagePriorityCallback(gpointer data); |
| 154 bool ManagePriorityCallback(); | 159 bool ManagePriorityCallback(); |
| 155 | 160 |
| 156 // Checks if a full update is needed and forces it by updating the Omaha | 161 // Checks if a full update is needed and forces it by updating the Omaha |
| 157 // request params. | 162 // request params. |
| 158 void DisableDeltaUpdateIfNeeded(); | 163 void DisableDeltaUpdateIfNeeded(); |
| 159 | 164 |
| 160 // If this was a delta update attempt that failed, count it so that a full | 165 // If this was a delta update attempt that failed, count it so that a full |
| 161 // update can be tried when needed. | 166 // update can be tried when needed. |
| 162 void MarkDeltaUpdateFailure(); | 167 void MarkDeltaUpdateFailure(); |
| 163 | 168 |
| 164 ProxyResolver* GetProxyResolver() { | 169 ProxyResolver* GetProxyResolver() { |
| 165 return obeying_proxies_ ? | 170 return obeying_proxies_ ? |
| 166 reinterpret_cast<ProxyResolver*>(&chrome_proxy_resolver_) : | 171 reinterpret_cast<ProxyResolver*>(&chrome_proxy_resolver_) : |
| 167 reinterpret_cast<ProxyResolver*>(&direct_proxy_resolver_); | 172 reinterpret_cast<ProxyResolver*>(&direct_proxy_resolver_); |
| 168 } | 173 } |
| 169 | 174 |
| 170 // Last status notification timestamp used for throttling. Use monotonic | 175 // Last status notification timestamp used for throttling. Use monotonic |
| 171 // TimeTicks to ensure that notifications are sent even if the system clock is | 176 // TimeTicks to ensure that notifications are sent even if the system clock is |
| 172 // set back in the middle of an update. | 177 // set back in the middle of an update. |
| 173 base::TimeTicks last_notify_time_; | 178 base::TimeTicks last_notify_time_; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // Our two proxy resolvers | 236 // Our two proxy resolvers |
| 232 DirectProxyResolver direct_proxy_resolver_; | 237 DirectProxyResolver direct_proxy_resolver_; |
| 233 ChromeProxyResolver chrome_proxy_resolver_; | 238 ChromeProxyResolver chrome_proxy_resolver_; |
| 234 | 239 |
| 235 DISALLOW_COPY_AND_ASSIGN(UpdateAttempter); | 240 DISALLOW_COPY_AND_ASSIGN(UpdateAttempter); |
| 236 }; | 241 }; |
| 237 | 242 |
| 238 } // namespace chromeos_update_engine | 243 } // namespace chromeos_update_engine |
| 239 | 244 |
| 240 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_ATTEMPTER_H__ | 245 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_ATTEMPTER_H__ |
| OLD | NEW |