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

Side by Side Diff: src/platform/update_engine/update_attempter.h

Issue 2055008: Init: Start Update Engine at startup (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: Created 10 years, 7 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
OLDNEW
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 #include <tr1/memory> 9 #include <tr1/memory>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 #include <glib.h> 12 #include <glib.h>
13 #include "update_engine/action_processor.h" 13 #include "update_engine/action_processor.h"
14 #include "update_engine/download_action.h" 14 #include "update_engine/download_action.h"
15 #include "update_engine/omaha_response_handler_action.h" 15 #include "update_engine/omaha_response_handler_action.h"
16 16
17 struct UpdateEngineService; 17 struct UpdateEngineService;
18 18
19 namespace chromeos_update_engine { 19 namespace chromeos_update_engine {
20 20
21 extern const char* kUpdateCompletedMarker;
22
21 enum UpdateStatus { 23 enum UpdateStatus {
22 UPDATE_STATUS_IDLE = 0, 24 UPDATE_STATUS_IDLE = 0,
23 UPDATE_STATUS_CHECKING_FOR_UPDATE, 25 UPDATE_STATUS_CHECKING_FOR_UPDATE,
24 UPDATE_STATUS_UPDATE_AVAILABLE, 26 UPDATE_STATUS_UPDATE_AVAILABLE,
25 UPDATE_STATUS_DOWNLOADING, 27 UPDATE_STATUS_DOWNLOADING,
26 UPDATE_STATUS_VERIFYING, 28 UPDATE_STATUS_VERIFYING,
27 UPDATE_STATUS_FINALIZING, 29 UPDATE_STATUS_FINALIZING,
28 UPDATE_STATUS_UPDATED_NEED_REBOOT 30 UPDATE_STATUS_UPDATED_NEED_REBOOT
29 }; 31 };
30 32
31 const char* UpdateStatusToString(UpdateStatus status); 33 const char* UpdateStatusToString(UpdateStatus status);
32 34
33 class UpdateAttempter : public ActionProcessorDelegate, 35 class UpdateAttempter : public ActionProcessorDelegate,
34 public DownloadActionDelegate { 36 public DownloadActionDelegate {
35 public: 37 public:
36 UpdateAttempter() : full_update_(false), 38 UpdateAttempter() : full_update_(false),
37 dbus_service_(NULL), 39 dbus_service_(NULL),
38 status_(UPDATE_STATUS_IDLE), 40 status_(UPDATE_STATUS_IDLE),
39 download_progress_(0.0), 41 download_progress_(0.0),
40 last_checked_time_(0), 42 last_checked_time_(0),
41 new_version_("0.0.0.0"), 43 new_version_("0.0.0.0"),
42 new_size_(0) { 44 new_size_(0) {
43 last_notify_time_.tv_sec = 0; 45 last_notify_time_.tv_sec = 0;
44 last_notify_time_.tv_nsec = 0; 46 last_notify_time_.tv_nsec = 0;
47 if (utils::FileExists(kUpdateCompletedMarker))
48 status_ = UPDATE_STATUS_UPDATED_NEED_REBOOT;
45 } 49 }
46 void Update(bool force_full_update); 50 void Update(bool force_full_update);
47 51
48 // ActionProcessorDelegate methods: 52 // ActionProcessorDelegate methods:
49 void ProcessingDone(const ActionProcessor* processor, bool success); 53 void ProcessingDone(const ActionProcessor* processor, bool success);
50 void ProcessingStopped(const ActionProcessor* processor); 54 void ProcessingStopped(const ActionProcessor* processor);
51 void ActionCompleted(ActionProcessor* processor, 55 void ActionCompleted(ActionProcessor* processor,
52 AbstractAction* action, 56 AbstractAction* action,
53 bool success); 57 bool success);
54 58
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 int64_t last_checked_time_; 103 int64_t last_checked_time_;
100 std::string new_version_; 104 std::string new_version_;
101 int64_t new_size_; 105 int64_t new_size_;
102 106
103 DISALLOW_COPY_AND_ASSIGN(UpdateAttempter); 107 DISALLOW_COPY_AND_ASSIGN(UpdateAttempter);
104 }; 108 };
105 109
106 } // namespace chromeos_update_engine 110 } // namespace chromeos_update_engine
107 111
108 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_ATTEMPTER_H__ 112 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_ATTEMPTER_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698