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

Side by Side Diff: dbus_service.cc

Issue 3034026: AU: Provide a reboot_if_needed D-Bus API. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: reboot error code doesn't necessarily signal a problem. 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 | « dbus_service.h ('k') | update_attempter.h » ('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 #include "update_engine/dbus_service.h" 5 #include "update_engine/dbus_service.h"
6 #include <string> 6 #include <string>
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "update_engine/marshal.glibmarshal.h" 8 #include "update_engine/marshal.glibmarshal.h"
9 9
10 using std::string; 10 using std::string;
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 41
42 static void update_engine_service_init(UpdateEngineService* object) { 42 static void update_engine_service_init(UpdateEngineService* object) {
43 } 43 }
44 44
45 UpdateEngineService* update_engine_service_new(void) { 45 UpdateEngineService* update_engine_service_new(void) {
46 return reinterpret_cast<UpdateEngineService*>( 46 return reinterpret_cast<UpdateEngineService*>(
47 g_object_new(UPDATE_ENGINE_TYPE_SERVICE, NULL)); 47 g_object_new(UPDATE_ENGINE_TYPE_SERVICE, NULL));
48 } 48 }
49 49
50 gboolean update_engine_service_attempt_update(UpdateEngineService* self,
51 gchar* app_version,
52 gchar* omaha_url,
53 GError **error) {
54 const string update_app_version = app_version ? app_version : "";
55 const string update_omaha_url = omaha_url ? omaha_url : "";
56 LOG(INFO) << "Attempt update: app_version=\"" << update_app_version << "\" "
57 << "omaha_url=\"" << update_omaha_url << "\"";
58 self->update_attempter_->CheckForUpdate(app_version, omaha_url);
59 return TRUE;
60 }
61
62 gboolean update_engine_service_check_for_update(UpdateEngineService* self,
63 GError **error) {
64 self->update_attempter_->CheckForUpdate("", "");
65 return TRUE;
66 }
67
50 gboolean update_engine_service_get_status(UpdateEngineService* self, 68 gboolean update_engine_service_get_status(UpdateEngineService* self,
51 int64_t* last_checked_time, 69 int64_t* last_checked_time,
52 double* progress, 70 double* progress,
53 gchar** current_operation, 71 gchar** current_operation,
54 gchar** new_version, 72 gchar** new_version,
55 int64_t* new_size, 73 int64_t* new_size,
56 GError **error) { 74 GError **error) {
57 string current_op; 75 string current_op;
58 string new_version_str; 76 string new_version_str;
59 77
60 CHECK(self->update_attempter_->GetStatus(last_checked_time, 78 CHECK(self->update_attempter_->GetStatus(last_checked_time,
61 progress, 79 progress,
62 &current_op, 80 &current_op,
63 &new_version_str, 81 &new_version_str,
64 new_size)); 82 new_size));
65 83
66 *current_operation = strdup(current_op.c_str()); 84 *current_operation = strdup(current_op.c_str());
67 *new_version = strdup(new_version_str.c_str()); 85 *new_version = strdup(new_version_str.c_str());
68 return TRUE; 86 return TRUE;
69 } 87 }
70 88
71 gboolean update_engine_service_attempt_update(UpdateEngineService* self, 89 gboolean update_engine_service_reboot_if_needed(UpdateEngineService* self,
72 gchar* app_version, 90 GError **error) {
73 gchar* omaha_url, 91 if (!self->update_attempter_->RebootIfNeeded()) {
74 GError **error) { 92 *error = NULL;
75 const string update_app_version = app_version ? app_version : ""; 93 return FALSE;
76 const string update_omaha_url = omaha_url ? omaha_url : ""; 94 }
77 LOG(INFO) << "Attempt update: app_version=\"" << update_app_version << "\" "
78 << "omaha_url=\"" << update_omaha_url << "\"";
79 self->update_attempter_->CheckForUpdate(app_version, omaha_url);
80 return TRUE; 95 return TRUE;
81 } 96 }
82 97
83 gboolean update_engine_service_check_for_update(UpdateEngineService* self,
84 GError **error) {
85 self->update_attempter_->CheckForUpdate("", "");
86 return TRUE;
87 }
88
89 gboolean update_engine_service_emit_status_update( 98 gboolean update_engine_service_emit_status_update(
90 UpdateEngineService* self, 99 UpdateEngineService* self,
91 gint64 last_checked_time, 100 gint64 last_checked_time,
92 gdouble progress, 101 gdouble progress,
93 const gchar* current_operation, 102 const gchar* current_operation,
94 const gchar* new_version, 103 const gchar* new_version,
95 gint64 new_size) { 104 gint64 new_size) {
96 g_signal_emit(self, 105 g_signal_emit(self,
97 status_update_signal, 106 status_update_signal,
98 0, 107 0,
99 last_checked_time, 108 last_checked_time,
100 progress, 109 progress,
101 current_operation, 110 current_operation,
102 new_version, 111 new_version,
103 new_size); 112 new_size);
104 return TRUE; 113 return TRUE;
105 } 114 }
OLDNEW
« no previous file with comments | « dbus_service.h ('k') | update_attempter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698