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/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/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" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 // Update the counter. It may seem counter-intuitive to update the message | 103 // Update the counter. It may seem counter-intuitive to update the message |
104 // after we attempt restart, but remember that shutdown may be aborted by | 104 // after we attempt restart, but remember that shutdown may be aborted by |
105 // an onbeforeunload handler, leaving the bubble up when the browser should | 105 // an onbeforeunload handler, leaving the bubble up when the browser should |
106 // have restarted (giving the user another chance). | 106 // have restarted (giving the user another chance). |
107 UpdateBubbleHeadline(seconds); | 107 UpdateBubbleHeadline(seconds); |
108 SchedulePaint(); | 108 SchedulePaint(); |
109 } | 109 } |
110 | 110 |
111 void CriticalNotificationBubbleView::ButtonPressed( | 111 void CriticalNotificationBubbleView::ButtonPressed( |
112 views::Button* sender, const views::Event& event) { | 112 views::Button* sender, const ui::Event& event) { |
113 // Let other bubbles know we have an answer from the user. | 113 // Let other bubbles know we have an answer from the user. |
114 UpgradeDetector::GetInstance()->acknowledge_critical_update(); | 114 UpgradeDetector::GetInstance()->acknowledge_critical_update(); |
115 | 115 |
116 if (sender == restart_button_) { | 116 if (sender == restart_button_) { |
117 content::RecordAction( | 117 content::RecordAction( |
118 UserMetricsAction("CriticalNotification_Restart")); | 118 UserMetricsAction("CriticalNotification_Restart")); |
119 browser::AttemptRestart(); | 119 browser::AttemptRestart(); |
120 } else if (sender == dismiss_button_) { | 120 } else if (sender == dismiss_button_) { |
121 content::RecordAction(UserMetricsAction("CriticalNotification_Ignore")); | 121 content::RecordAction(UserMetricsAction("CriticalNotification_Ignore")); |
122 // If the counter reaches 0, we set a restart flag that must be cleared if | 122 // If the counter reaches 0, we set a restart flag that must be cleared if |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 dismiss_button_ = new views::NativeTextButton(this, | 218 dismiss_button_ = new views::NativeTextButton(this, |
219 l10n_util::GetStringUTF16(IDS_CRITICAL_NOTIFICATION_DISMISS)); | 219 l10n_util::GetStringUTF16(IDS_CRITICAL_NOTIFICATION_DISMISS)); |
220 layout->AddView(dismiss_button_); | 220 layout->AddView(dismiss_button_); |
221 | 221 |
222 refresh_timer_.Start(FROM_HERE, | 222 refresh_timer_.Start(FROM_HERE, |
223 base::TimeDelta::FromMilliseconds(kRefreshBubbleEvery), | 223 base::TimeDelta::FromMilliseconds(kRefreshBubbleEvery), |
224 this, &CriticalNotificationBubbleView::OnCountdown); | 224 this, &CriticalNotificationBubbleView::OnCountdown); |
225 | 225 |
226 content::RecordAction(UserMetricsAction("CriticalNotificationShown")); | 226 content::RecordAction(UserMetricsAction("CriticalNotificationShown")); |
227 } | 227 } |
OLD | NEW |