OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include <base/logging.h> | 9 #include <base/logging.h> |
10 | 10 |
11 #include "update_engine/marshal.glibmarshal.h" | 11 #include "update_engine/marshal.glibmarshal.h" |
12 #include "update_engine/omaha_request_params.h" | 12 #include "update_engine/omaha_request_params.h" |
13 #include "update_engine/utils.h" | 13 #include "update_engine/utils.h" |
14 | 14 |
15 using std::string; | 15 using std::string; |
16 | 16 |
| 17 static const char kAUTestURLRequest[] = "autest"; |
| 18 static const char kAUTestURL[] = |
| 19 "https://omaha.corp.google.com:8082/service/update2"; |
| 20 |
17 G_DEFINE_TYPE(UpdateEngineService, update_engine_service, G_TYPE_OBJECT) | 21 G_DEFINE_TYPE(UpdateEngineService, update_engine_service, G_TYPE_OBJECT) |
18 | 22 |
19 static void update_engine_service_finalize(GObject* object) { | 23 static void update_engine_service_finalize(GObject* object) { |
20 G_OBJECT_CLASS(update_engine_service_parent_class)->finalize(object); | 24 G_OBJECT_CLASS(update_engine_service_parent_class)->finalize(object); |
21 } | 25 } |
22 | 26 |
23 static guint status_update_signal = 0; | 27 static guint status_update_signal = 0; |
24 | 28 |
25 static void update_engine_service_class_init(UpdateEngineServiceClass* klass) { | 29 static void update_engine_service_class_init(UpdateEngineServiceClass* klass) { |
26 GObjectClass *object_class; | 30 GObjectClass *object_class; |
(...skipping 25 matching lines...) Expand all Loading... |
52 g_object_new(UPDATE_ENGINE_TYPE_SERVICE, NULL)); | 56 g_object_new(UPDATE_ENGINE_TYPE_SERVICE, NULL)); |
53 } | 57 } |
54 | 58 |
55 gboolean update_engine_service_attempt_update(UpdateEngineService* self, | 59 gboolean update_engine_service_attempt_update(UpdateEngineService* self, |
56 gchar* app_version, | 60 gchar* app_version, |
57 gchar* omaha_url, | 61 gchar* omaha_url, |
58 GError **error) { | 62 GError **error) { |
59 string update_app_version; | 63 string update_app_version; |
60 string update_omaha_url; | 64 string update_omaha_url; |
61 // Only non-official (e.g., dev and test) builds can override the current | 65 // Only non-official (e.g., dev and test) builds can override the current |
62 // version and update server URL over D-Bus. | 66 // version and update server URL over D-Bus. However, pointing to the |
| 67 // hardcoded test update server URL is always allowed. |
63 if (!chromeos_update_engine::utils::IsOfficialBuild()) { | 68 if (!chromeos_update_engine::utils::IsOfficialBuild()) { |
64 if (app_version) { | 69 if (app_version) { |
65 update_app_version = app_version; | 70 update_app_version = app_version; |
66 } | 71 } |
67 if (omaha_url) { | 72 if (omaha_url) { |
68 update_omaha_url = omaha_url; | 73 update_omaha_url = omaha_url; |
69 } | 74 } |
70 } | 75 } |
| 76 if (omaha_url && strcmp(omaha_url, kAUTestURLRequest) == 0) { |
| 77 update_omaha_url = kAUTestURL; |
| 78 } |
71 LOG(INFO) << "Attempt update: app_version=\"" << update_app_version << "\" " | 79 LOG(INFO) << "Attempt update: app_version=\"" << update_app_version << "\" " |
72 << "omaha_url=\"" << update_omaha_url << "\""; | 80 << "omaha_url=\"" << update_omaha_url << "\""; |
73 self->update_attempter_->CheckForUpdate(update_app_version, update_omaha_url); | 81 self->update_attempter_->CheckForUpdate(update_app_version, update_omaha_url); |
74 return TRUE; | 82 return TRUE; |
75 } | 83 } |
76 | 84 |
77 gboolean update_engine_service_get_status(UpdateEngineService* self, | 85 gboolean update_engine_service_get_status(UpdateEngineService* self, |
78 int64_t* last_checked_time, | 86 int64_t* last_checked_time, |
79 double* progress, | 87 double* progress, |
80 gchar** current_operation, | 88 gchar** current_operation, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 g_signal_emit(self, | 149 g_signal_emit(self, |
142 status_update_signal, | 150 status_update_signal, |
143 0, | 151 0, |
144 last_checked_time, | 152 last_checked_time, |
145 progress, | 153 progress, |
146 current_operation, | 154 current_operation, |
147 new_version, | 155 new_version, |
148 new_size); | 156 new_size); |
149 return TRUE; | 157 return TRUE; |
150 } | 158 } |
OLD | NEW |