Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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 "chrome/browser/ui/webui/help/version_updater_chromeos.h" | 5 #include "chrome/browser/ui/webui/help/version_updater_chromeos.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "chrome/browser/chromeos/cros_settings.h" | 11 #include "chrome/browser/chromeos/cros_settings.h" |
| 12 #include "chrome/browser/chromeos/cros_settings_names.h" | 12 #include "chrome/browser/chromeos/cros_settings_names.h" |
| 13 #include "chrome/browser/chromeos/login/user_manager.h" | 13 #include "chrome/browser/chromeos/login/user_manager.h" |
| 14 #include "chrome/browser/chromeos/login/wizard_controller.h" | 14 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 15 #include "chrome/browser/google/google_update.h" | |
| 16 #include "chromeos/dbus/dbus_thread_manager.h" | 15 #include "chromeos/dbus/dbus_thread_manager.h" |
| 17 #include "chromeos/dbus/power_manager_client.h" | 16 #include "chromeos/dbus/power_manager_client.h" |
| 18 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
| 20 | 19 |
| 21 using chromeos::CrosSettings; | 20 using chromeos::CrosSettings; |
| 22 using chromeos::DBusThreadManager; | 21 using chromeos::DBusThreadManager; |
| 23 using chromeos::UpdateEngineClient; | 22 using chromeos::UpdateEngineClient; |
| 24 using chromeos::UserManager; | 23 using chromeos::UserManager; |
| 25 using chromeos::WizardController; | 24 using chromeos::WizardController; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 last_operation_ != | 93 last_operation_ != |
| 95 UpdateEngineClient::UPDATE_STATUS_CHECKING_FOR_UPDATE) { | 94 UpdateEngineClient::UPDATE_STATUS_CHECKING_FOR_UPDATE) { |
| 96 operation_to_show = last_operation_; | 95 operation_to_show = last_operation_; |
| 97 } | 96 } |
| 98 | 97 |
| 99 switch (operation_to_show) { | 98 switch (operation_to_show) { |
| 100 case UpdateEngineClient::UPDATE_STATUS_ERROR: | 99 case UpdateEngineClient::UPDATE_STATUS_ERROR: |
| 101 case UpdateEngineClient::UPDATE_STATUS_REPORTING_ERROR_EVENT: | 100 case UpdateEngineClient::UPDATE_STATUS_REPORTING_ERROR_EVENT: |
| 102 my_status = FAILED; | 101 my_status = FAILED; |
| 103 // TODO(derat): More-detailed error info if UpdateEngineClient exposes it. | 102 // TODO(derat): More-detailed error info if UpdateEngineClient exposes it. |
| 104 message = l10n_util::GetStringFUTF16Int(IDS_UPGRADE_ERROR, | 103 message = l10n_util::GetStringFUTF16Int(IDS_UPGRADE_ERROR, 7); |
|
Daniel Erat
2012/07/13 19:27:56
this is fine with me, but mind adding a comment li
MAD
2012/07/13 19:36:59
Done.
| |
| 105 GOOGLE_UPDATE_ERROR_UPDATING); | |
| 106 break; | 104 break; |
| 107 case UpdateEngineClient::UPDATE_STATUS_CHECKING_FOR_UPDATE: | 105 case UpdateEngineClient::UPDATE_STATUS_CHECKING_FOR_UPDATE: |
| 108 my_status = CHECKING; | 106 my_status = CHECKING; |
| 109 break; | 107 break; |
| 110 case UpdateEngineClient::UPDATE_STATUS_DOWNLOADING: | 108 case UpdateEngineClient::UPDATE_STATUS_DOWNLOADING: |
| 111 progress = static_cast<int>(round(status.download_progress * 100)); | 109 progress = static_cast<int>(round(status.download_progress * 100)); |
| 112 // Fall through. | 110 // Fall through. |
| 113 case UpdateEngineClient::UPDATE_STATUS_UPDATE_AVAILABLE: | 111 case UpdateEngineClient::UPDATE_STATUS_UPDATE_AVAILABLE: |
| 114 my_status = UPDATING; | 112 my_status = UPDATING; |
| 115 break; | 113 break; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 135 UpdateEngineClient::UpdateCheckResult result) { | 133 UpdateEngineClient::UpdateCheckResult result) { |
| 136 // If version updating is not implemented, this binary is the most up-to-date | 134 // If version updating is not implemented, this binary is the most up-to-date |
| 137 // possible with respect to automatic updating. | 135 // possible with respect to automatic updating. |
| 138 if (result == UpdateEngineClient::UPDATE_RESULT_NOTIMPLEMENTED) | 136 if (result == UpdateEngineClient::UPDATE_RESULT_NOTIMPLEMENTED) |
| 139 callback_.Run(UPDATED, 0, string16()); | 137 callback_.Run(UPDATED, 0, string16()); |
| 140 } | 138 } |
| 141 | 139 |
| 142 void VersionUpdaterCros::UpdateSelectedChannel(const std::string& channel) { | 140 void VersionUpdaterCros::UpdateSelectedChannel(const std::string& channel) { |
| 143 channel_callback_.Run(channel); | 141 channel_callback_.Run(channel); |
| 144 } | 142 } |
| OLD | NEW |