| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/chromeos/update_observer.h" | 5 #include "chrome/browser/chromeos/update_observer.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/common/time_format.h" | 10 #include "chrome/common/time_format.h" |
| 11 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
| 12 #include "grit/theme_resources.h" | 12 #include "grit/theme_resources.h" |
| 13 | 13 |
| 14 namespace chromeos { | 14 namespace chromeos { |
| 15 | 15 |
| 16 UpdateObserver::UpdateObserver(Profile* profile) | 16 UpdateObserver::UpdateObserver(Profile* profile) |
| 17 : notification_(profile, "update.chromeos", IDR_NOTIFICATION_UPDATE, | 17 : notification_(profile, "update.chromeos", IDR_NOTIFICATION_UPDATE, |
| 18 l10n_util::GetStringUTF16(IDS_UPDATE_TITLE)), | 18 l10n_util::GetStringUTF16(IDS_UPDATE_TITLE)), |
| 19 progress_(-1) {} | 19 progress_(-1) {} |
| 20 | 20 |
| 21 UpdateObserver::~UpdateObserver() { | 21 UpdateObserver::~UpdateObserver() { |
| 22 notification_.Hide(); | 22 notification_.Hide(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void UpdateObserver::Changed(UpdateLibrary* object) { | 25 void UpdateObserver::Changed(UpdateLibrary* object) { |
| 26 switch (object->status().status) { | 26 switch (object->status().status) { |
| 27 case UPDATE_STATUS_ERROR: | |
| 28 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_ERROR), true); | |
| 29 break; | |
| 30 case UPDATE_STATUS_IDLE: | 27 case UPDATE_STATUS_IDLE: |
| 31 case UPDATE_STATUS_CHECKING_FOR_UPDATE: | 28 case UPDATE_STATUS_CHECKING_FOR_UPDATE: |
| 32 // Do nothing in these cases, we don't want to notify the user of the | 29 // Do nothing in these cases, we don't want to notify the user of the |
| 33 // check unless there is an update. We don't hide here because | 30 // check unless there is an update. We don't hide here because |
| 34 // we want the final state to be sticky. | 31 // we want the final state to be sticky. |
| 35 break; | 32 break; |
| 36 case UPDATE_STATUS_UPDATE_AVAILABLE: | 33 case UPDATE_STATUS_UPDATE_AVAILABLE: |
| 37 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_AVAILABLE), | 34 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_AVAILABLE), |
| 38 false); | 35 false); |
| 39 break; | 36 break; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 52 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_VERIFYING), | 49 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_VERIFYING), |
| 53 false); | 50 false); |
| 54 break; | 51 break; |
| 55 case UPDATE_STATUS_FINALIZING: | 52 case UPDATE_STATUS_FINALIZING: |
| 56 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_FINALIZING), | 53 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_FINALIZING), |
| 57 false); | 54 false); |
| 58 break; | 55 break; |
| 59 case UPDATE_STATUS_UPDATED_NEED_REBOOT: | 56 case UPDATE_STATUS_UPDATED_NEED_REBOOT: |
| 60 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_COMPLETED), true); | 57 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_COMPLETED), true); |
| 61 break; | 58 break; |
| 59 default: |
| 60 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_ERROR), true); |
| 61 break; |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace chromeos | 65 } // namespace chromeos |
| 66 | |
| OLD | NEW |