| 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/views/critical_notification_bubble_view.h" | 5 #include "chrome/browser/ui/views/critical_notification_bubble_view.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/i18n/message_formatter.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/lifetime/application_lifetime.h" | 10 #include "chrome/browser/lifetime/application_lifetime.h" |
| 11 #include "chrome/browser/upgrade_detector.h" | 11 #include "chrome/browser/upgrade_detector.h" |
| 12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
| 13 #include "chrome/grit/chromium_strings.h" | 13 #include "chrome/grit/chromium_strings.h" |
| 14 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_resources.h" |
| 15 #include "chrome/grit/locale_settings.h" | 15 #include "chrome/grit/locale_settings.h" |
| 16 #include "components/prefs/pref_service.h" | 16 #include "components/prefs/pref_service.h" |
| 17 #include "content/public/browser/user_metrics.h" | 17 #include "content/public/browser/user_metrics.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 // Update the counter. It may seem counter-intuitive to update the message | 77 // Update the counter. It may seem counter-intuitive to update the message |
| 78 // after we attempt restart, but remember that shutdown may be aborted by | 78 // after we attempt restart, but remember that shutdown may be aborted by |
| 79 // an onbeforeunload handler, leaving the bubble up when the browser should | 79 // an onbeforeunload handler, leaving the bubble up when the browser should |
| 80 // have restarted (giving the user another chance). | 80 // have restarted (giving the user another chance). |
| 81 GetBubbleFrameView()->UpdateWindowTitle(); | 81 GetBubbleFrameView()->UpdateWindowTitle(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 base::string16 CriticalNotificationBubbleView::GetWindowTitle() const { | 84 base::string16 CriticalNotificationBubbleView::GetWindowTitle() const { |
| 85 int seconds = GetRemainingTime(); | 85 int seconds = GetRemainingTime(); |
| 86 return seconds > 0 ? l10n_util::GetStringFUTF16( | 86 return seconds > 0 ? base::i18n::MessageFormatter::FormatWithNumberedArgs( |
| 87 IDS_CRITICAL_NOTIFICATION_HEADLINE, | 87 l10n_util::GetStringUTF16( |
| 88 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), | 88 IDS_CRITICAL_NOTIFICATION_HEADLINE), |
| 89 base::IntToString16(seconds)) | 89 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME), seconds) |
| 90 : l10n_util::GetStringFUTF16( | 90 : l10n_util::GetStringFUTF16( |
| 91 IDS_CRITICAL_NOTIFICATION_HEADLINE_ALTERNATE, | 91 IDS_CRITICAL_NOTIFICATION_HEADLINE_ALTERNATE, |
| 92 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 92 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| 93 } | 93 } |
| 94 | 94 |
| 95 gfx::ImageSkia CriticalNotificationBubbleView::GetWindowIcon() { | 95 gfx::ImageSkia CriticalNotificationBubbleView::GetWindowIcon() { |
| 96 return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 96 return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 97 IDR_UPDATE_MENU_SEVERITY_HIGH); | 97 IDR_UPDATE_MENU_SEVERITY_HIGH); |
| 98 } | 98 } |
| 99 | 99 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 void CriticalNotificationBubbleView::GetAccessibleState( | 155 void CriticalNotificationBubbleView::GetAccessibleState( |
| 156 ui::AXViewState* state) { | 156 ui::AXViewState* state) { |
| 157 state->role = ui::AX_ROLE_ALERT; | 157 state->role = ui::AX_ROLE_ALERT; |
| 158 } | 158 } |
| 159 | 159 |
| 160 void CriticalNotificationBubbleView::ViewHierarchyChanged( | 160 void CriticalNotificationBubbleView::ViewHierarchyChanged( |
| 161 const ViewHierarchyChangedDetails& details) { | 161 const ViewHierarchyChangedDetails& details) { |
| 162 if (details.is_add && details.child == this) | 162 if (details.is_add && details.child == this) |
| 163 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 163 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 164 } | 164 } |
| OLD | NEW |