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

Side by Side Diff: update_attempter.h

Issue 3048008: Add support to update_engine_client for -app_version and -omaha_url. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: Don't use ?: shorthand. Created 10 years, 5 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
« no previous file with comments | « omaha_request_params_unittest.cc ('k') | update_attempter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 status_(UPDATE_STATUS_IDLE), 44 status_(UPDATE_STATUS_IDLE),
45 download_progress_(0.0), 45 download_progress_(0.0),
46 last_checked_time_(0), 46 last_checked_time_(0),
47 new_version_("0.0.0.0"), 47 new_version_("0.0.0.0"),
48 new_size_(0) { 48 new_size_(0) {
49 last_notify_time_.tv_sec = 0; 49 last_notify_time_.tv_sec = 0;
50 last_notify_time_.tv_nsec = 0; 50 last_notify_time_.tv_nsec = 0;
51 if (utils::FileExists(kUpdateCompletedMarker)) 51 if (utils::FileExists(kUpdateCompletedMarker))
52 status_ = UPDATE_STATUS_UPDATED_NEED_REBOOT; 52 status_ = UPDATE_STATUS_UPDATED_NEED_REBOOT;
53 } 53 }
54 void Update(); 54 // Checks for update and, if a newer version is available, attempts
55 // to update the system. Non-empty |in_app_version| or
56 // |in_update_url| prevents automatic detection of the parameter.
57 void Update(const std::string& app_version, const std::string& omaha_url);
55 58
56 // ActionProcessorDelegate methods: 59 // ActionProcessorDelegate methods:
57 void ProcessingDone(const ActionProcessor* processor, ActionExitCode code); 60 void ProcessingDone(const ActionProcessor* processor, ActionExitCode code);
58 void ProcessingStopped(const ActionProcessor* processor); 61 void ProcessingStopped(const ActionProcessor* processor);
59 void ActionCompleted(ActionProcessor* processor, 62 void ActionCompleted(ActionProcessor* processor,
60 AbstractAction* action, 63 AbstractAction* action,
61 ActionExitCode code); 64 ActionExitCode code);
62 65
63 // Stop updating. An attempt will be made to record status to the disk 66 // Stop updating. An attempt will be made to record status to the disk
64 // so that updates can be resumed later. 67 // so that updates can be resumed later.
65 void Terminate(); 68 void Terminate();
66 69
67 // Try to resume from a previously Terminate()d update. 70 // Try to resume from a previously Terminate()d update.
68 void ResumeUpdating(); 71 void ResumeUpdating();
69 72
70 // Returns the current status in the out params. Returns true on success. 73 // Returns the current status in the out params. Returns true on success.
71 bool GetStatus(int64_t* last_checked_time, 74 bool GetStatus(int64_t* last_checked_time,
72 double* progress, 75 double* progress,
73 std::string* current_operation, 76 std::string* current_operation,
74 std::string* new_version, 77 std::string* new_version,
75 int64_t* new_size); 78 int64_t* new_size);
76 79
77 void set_dbus_service(struct UpdateEngineService* dbus_service) { 80 void set_dbus_service(struct UpdateEngineService* dbus_service) {
78 dbus_service_ = dbus_service; 81 dbus_service_ = dbus_service;
79 } 82 }
80 83
81 void CheckForUpdate(); 84 // This is the D-Bus service entry point for going through an
85 // update. If the current status is idle invokes Update.
86 void CheckForUpdate(const std::string& app_version,
87 const std::string& omaha_url);
82 88
83 // DownloadActionDelegate method 89 // DownloadActionDelegate method
84 void BytesReceived(uint64_t bytes_received, uint64_t total); 90 void BytesReceived(uint64_t bytes_received, uint64_t total);
85 91
86 private: 92 private:
87 // Sets the status to the given status and notifies a status update 93 // Sets the status to the given status and notifies a status update
88 // over dbus. 94 // over dbus.
89 void SetStatusAndNotify(UpdateStatus status); 95 void SetStatusAndNotify(UpdateStatus status);
90 96
91 // Creates an error event object in |error_event_| to be included in 97 // Creates an error event object in |error_event_| to be included in
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 131
126 // Device paramaters common to all Omaha requests. 132 // Device paramaters common to all Omaha requests.
127 OmahaRequestDeviceParams omaha_request_params_; 133 OmahaRequestDeviceParams omaha_request_params_;
128 134
129 DISALLOW_COPY_AND_ASSIGN(UpdateAttempter); 135 DISALLOW_COPY_AND_ASSIGN(UpdateAttempter);
130 }; 136 };
131 137
132 } // namespace chromeos_update_engine 138 } // namespace chromeos_update_engine
133 139
134 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_ATTEMPTER_H__ 140 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_UPDATE_ATTEMPTER_H__
OLDNEW
« no previous file with comments | « omaha_request_params_unittest.cc ('k') | update_attempter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698