| 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" | |
| 9 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/common/time_format.h" | 9 #include "chrome/common/time_format.h" |
| 11 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
| 12 #include "grit/theme_resources.h" | 11 #include "grit/theme_resources.h" |
| 13 | 12 |
| 14 namespace chromeos { | 13 namespace chromeos { |
| 15 | 14 |
| 16 UpdateObserver::UpdateObserver(Profile* profile) | 15 UpdateObserver::UpdateObserver(Profile* profile) |
| 17 : notification_(profile, "update.chromeos", IDR_NOTIFICATION_UPDATE, | 16 : notification_(profile, "update.chromeos", IDR_NOTIFICATION_UPDATE, |
| 18 l10n_util::GetStringUTF16(IDS_UPDATE_TITLE)), | 17 l10n_util::GetStringUTF16(IDS_UPDATE_TITLE)), |
| (...skipping 15 matching lines...) Expand all Loading... |
| 34 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_AVAILABLE), | 33 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_AVAILABLE), |
| 35 false); | 34 false); |
| 36 break; | 35 break; |
| 37 case UPDATE_STATUS_DOWNLOADING: | 36 case UPDATE_STATUS_DOWNLOADING: |
| 38 { | 37 { |
| 39 int progress = static_cast<int>(library->status().download_progress * | 38 int progress = static_cast<int>(library->status().download_progress * |
| 40 100.0); | 39 100.0); |
| 41 if (progress != progress_) { | 40 if (progress != progress_) { |
| 42 progress_ = progress; | 41 progress_ = progress; |
| 43 notification_.Show(l10n_util::GetStringFUTF16(IDS_UPDATE_DOWNLOADING, | 42 notification_.Show(l10n_util::GetStringFUTF16(IDS_UPDATE_DOWNLOADING, |
| 44 IntToString16(progress_)), false); | 43 base::IntToString16(progress_)), false); |
| 45 } | 44 } |
| 46 } | 45 } |
| 47 break; | 46 break; |
| 48 case UPDATE_STATUS_VERIFYING: | 47 case UPDATE_STATUS_VERIFYING: |
| 49 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_VERIFYING), | 48 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_VERIFYING), |
| 50 false); | 49 false); |
| 51 break; | 50 break; |
| 52 case UPDATE_STATUS_FINALIZING: | 51 case UPDATE_STATUS_FINALIZING: |
| 53 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_FINALIZING), | 52 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_FINALIZING), |
| 54 false); | 53 false); |
| 55 break; | 54 break; |
| 56 case UPDATE_STATUS_UPDATED_NEED_REBOOT: | 55 case UPDATE_STATUS_UPDATED_NEED_REBOOT: |
| 57 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_COMPLETED), true); | 56 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_COMPLETED), true); |
| 58 break; | 57 break; |
| 59 default: | 58 default: |
| 60 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_ERROR), true); | 59 notification_.Show(l10n_util::GetStringUTF16(IDS_UPDATE_ERROR), true); |
| 61 break; | 60 break; |
| 62 } | 61 } |
| 63 } | 62 } |
| 64 | 63 |
| 65 } // namespace chromeos | 64 } // namespace chromeos |
| OLD | NEW |