| 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/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/lifetime/application_lifetime.h" | 9 #include "chrome/browser/lifetime/application_lifetime.h" |
| 10 #include "chrome/browser/upgrade_detector.h" | 10 #include "chrome/browser/upgrade_detector.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 | 82 |
| 83 base::string16 CriticalNotificationBubbleView::GetWindowTitle() const { | 83 base::string16 CriticalNotificationBubbleView::GetWindowTitle() const { |
| 84 int seconds = GetRemainingTime(); | 84 int seconds = GetRemainingTime(); |
| 85 return seconds > 0 ? l10n_util::GetPluralStringFUTF16( | 85 return seconds > 0 ? l10n_util::GetPluralStringFUTF16( |
| 86 IDS_CRITICAL_NOTIFICATION_HEADLINE, seconds) | 86 IDS_CRITICAL_NOTIFICATION_HEADLINE, seconds) |
| 87 : l10n_util::GetStringUTF16( | 87 : l10n_util::GetStringUTF16( |
| 88 IDS_CRITICAL_NOTIFICATION_HEADLINE_ALTERNATE); | 88 IDS_CRITICAL_NOTIFICATION_HEADLINE_ALTERNATE); |
| 89 } | 89 } |
| 90 | 90 |
| 91 gfx::ImageSkia CriticalNotificationBubbleView::GetWindowIcon() { | |
| 92 return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | |
| 93 IDR_UPDATE_MENU_SEVERITY_HIGH); | |
| 94 } | |
| 95 | |
| 96 bool CriticalNotificationBubbleView::ShouldShowWindowIcon() const { | |
| 97 return true; | |
| 98 } | |
| 99 | |
| 100 void CriticalNotificationBubbleView::WindowClosing() { | 91 void CriticalNotificationBubbleView::WindowClosing() { |
| 101 refresh_timer_.Stop(); | 92 refresh_timer_.Stop(); |
| 102 } | 93 } |
| 103 | 94 |
| 104 bool CriticalNotificationBubbleView::Cancel() { | 95 bool CriticalNotificationBubbleView::Cancel() { |
| 105 UpgradeDetector::GetInstance()->acknowledge_critical_update(); | 96 UpgradeDetector::GetInstance()->acknowledge_critical_update(); |
| 106 content::RecordAction(UserMetricsAction("CriticalNotification_Ignore")); | 97 content::RecordAction(UserMetricsAction("CriticalNotification_Ignore")); |
| 107 // If the counter reaches 0, we set a restart flag that must be cleared if | 98 // If the counter reaches 0, we set a restart flag that must be cleared if |
| 108 // the user selects, for example, "Stay on this page" during an | 99 // the user selects, for example, "Stay on this page" during an |
| 109 // onbeforeunload handler. | 100 // onbeforeunload handler. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 void CriticalNotificationBubbleView::GetAccessibleNodeData( | 141 void CriticalNotificationBubbleView::GetAccessibleNodeData( |
| 151 ui::AXNodeData* node_data) { | 142 ui::AXNodeData* node_data) { |
| 152 node_data->role = ui::AX_ROLE_ALERT; | 143 node_data->role = ui::AX_ROLE_ALERT; |
| 153 } | 144 } |
| 154 | 145 |
| 155 void CriticalNotificationBubbleView::ViewHierarchyChanged( | 146 void CriticalNotificationBubbleView::ViewHierarchyChanged( |
| 156 const ViewHierarchyChangedDetails& details) { | 147 const ViewHierarchyChangedDetails& details) { |
| 157 if (details.is_add && details.child == this) | 148 if (details.is_add && details.child == this) |
| 158 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 149 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 159 } | 150 } |
| OLD | NEW |