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 #include "update_engine/dbus_service.h" | 5 #include "update_engine/dbus_service.h" |
| 6 |
6 #include <string> | 7 #include <string> |
7 #include "base/logging.h" | 8 |
| 9 #include <base/logging.h> |
| 10 |
8 #include "update_engine/marshal.glibmarshal.h" | 11 #include "update_engine/marshal.glibmarshal.h" |
| 12 #include "update_engine/utils.h" |
9 | 13 |
10 using std::string; | 14 using std::string; |
11 | 15 |
12 G_DEFINE_TYPE(UpdateEngineService, update_engine_service, G_TYPE_OBJECT) | 16 G_DEFINE_TYPE(UpdateEngineService, update_engine_service, G_TYPE_OBJECT) |
13 | 17 |
14 static void update_engine_service_finalize(GObject* object) { | 18 static void update_engine_service_finalize(GObject* object) { |
15 G_OBJECT_CLASS(update_engine_service_parent_class)->finalize(object); | 19 G_OBJECT_CLASS(update_engine_service_parent_class)->finalize(object); |
16 } | 20 } |
17 | 21 |
18 static guint status_update_signal = 0; | 22 static guint status_update_signal = 0; |
(...skipping 25 matching lines...) Expand all Loading... |
44 | 48 |
45 UpdateEngineService* update_engine_service_new(void) { | 49 UpdateEngineService* update_engine_service_new(void) { |
46 return reinterpret_cast<UpdateEngineService*>( | 50 return reinterpret_cast<UpdateEngineService*>( |
47 g_object_new(UPDATE_ENGINE_TYPE_SERVICE, NULL)); | 51 g_object_new(UPDATE_ENGINE_TYPE_SERVICE, NULL)); |
48 } | 52 } |
49 | 53 |
50 gboolean update_engine_service_attempt_update(UpdateEngineService* self, | 54 gboolean update_engine_service_attempt_update(UpdateEngineService* self, |
51 gchar* app_version, | 55 gchar* app_version, |
52 gchar* omaha_url, | 56 gchar* omaha_url, |
53 GError **error) { | 57 GError **error) { |
54 const string update_app_version = app_version ? app_version : ""; | 58 string update_app_version; |
55 const string update_omaha_url = omaha_url ? omaha_url : ""; | 59 string update_omaha_url; |
| 60 // Only non-official (e.g., dev and test) builds can override the current |
| 61 // version and update server URL over D-Bus. |
| 62 if (!chromeos_update_engine::utils::IsOfficialBuild()) { |
| 63 if (app_version) { |
| 64 update_app_version = app_version; |
| 65 } |
| 66 if (omaha_url) { |
| 67 update_omaha_url = omaha_url; |
| 68 } |
| 69 } |
56 LOG(INFO) << "Attempt update: app_version=\"" << update_app_version << "\" " | 70 LOG(INFO) << "Attempt update: app_version=\"" << update_app_version << "\" " |
57 << "omaha_url=\"" << update_omaha_url << "\""; | 71 << "omaha_url=\"" << update_omaha_url << "\""; |
58 self->update_attempter_->CheckForUpdate(app_version, omaha_url); | 72 self->update_attempter_->CheckForUpdate(app_version, omaha_url); |
59 return TRUE; | 73 return TRUE; |
60 } | 74 } |
61 | 75 |
62 gboolean update_engine_service_get_status(UpdateEngineService* self, | 76 gboolean update_engine_service_get_status(UpdateEngineService* self, |
63 int64_t* last_checked_time, | 77 int64_t* last_checked_time, |
64 double* progress, | 78 double* progress, |
65 gchar** current_operation, | 79 gchar** current_operation, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 g_signal_emit(self, | 117 g_signal_emit(self, |
104 status_update_signal, | 118 status_update_signal, |
105 0, | 119 0, |
106 last_checked_time, | 120 last_checked_time, |
107 progress, | 121 progress, |
108 current_operation, | 122 current_operation, |
109 new_version, | 123 new_version, |
110 new_size); | 124 new_size); |
111 return TRUE; | 125 return TRUE; |
112 } | 126 } |
OLD | NEW |