| 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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 refresh_timer_.Stop(); | 135 refresh_timer_.Stop(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void CriticalNotificationBubbleView::GetAccessibleState( | 138 void CriticalNotificationBubbleView::GetAccessibleState( |
| 139 ui::AccessibleViewState* state) { | 139 ui::AccessibleViewState* state) { |
| 140 state->role = ui::AccessibilityTypes::ROLE_ALERT; | 140 state->role = ui::AccessibilityTypes::ROLE_ALERT; |
| 141 } | 141 } |
| 142 | 142 |
| 143 void CriticalNotificationBubbleView::ViewHierarchyChanged( | 143 void CriticalNotificationBubbleView::ViewHierarchyChanged( |
| 144 bool is_add, View* parent, View* child) { | 144 bool is_add, View* parent, View* child) { |
| 145 if (is_add && child == this) { | 145 if (is_add && child == this) |
| 146 GetWidget()->NotifyAccessibilityEvent( | 146 NotifyAccessibilityEvent(ui::AccessibilityTypes::EVENT_ALERT, true); |
| 147 this, ui::AccessibilityTypes::EVENT_ALERT, true); | |
| 148 } | |
| 149 } | 147 } |
| 150 | 148 |
| 151 bool CriticalNotificationBubbleView::AcceleratorPressed( | 149 bool CriticalNotificationBubbleView::AcceleratorPressed( |
| 152 const ui::Accelerator& accelerator) { | 150 const ui::Accelerator& accelerator) { |
| 153 if (accelerator.key_code() == ui::VKEY_ESCAPE) | 151 if (accelerator.key_code() == ui::VKEY_ESCAPE) |
| 154 UpgradeDetector::GetInstance()->acknowledge_critical_update(); | 152 UpgradeDetector::GetInstance()->acknowledge_critical_update(); |
| 155 return BubbleDelegateView::AcceleratorPressed(accelerator); | 153 return BubbleDelegateView::AcceleratorPressed(accelerator); |
| 156 } | 154 } |
| 157 | 155 |
| 158 void CriticalNotificationBubbleView::Init() { | 156 void CriticalNotificationBubbleView::Init() { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 l10n_util::GetStringUTF16(IDS_CRITICAL_NOTIFICATION_DISMISS)); | 217 l10n_util::GetStringUTF16(IDS_CRITICAL_NOTIFICATION_DISMISS)); |
| 220 dismiss_button_->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON); | 218 dismiss_button_->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON); |
| 221 layout->AddView(dismiss_button_); | 219 layout->AddView(dismiss_button_); |
| 222 | 220 |
| 223 refresh_timer_.Start(FROM_HERE, | 221 refresh_timer_.Start(FROM_HERE, |
| 224 base::TimeDelta::FromMilliseconds(kRefreshBubbleEvery), | 222 base::TimeDelta::FromMilliseconds(kRefreshBubbleEvery), |
| 225 this, &CriticalNotificationBubbleView::OnCountdown); | 223 this, &CriticalNotificationBubbleView::OnCountdown); |
| 226 | 224 |
| 227 content::RecordAction(UserMetricsAction("CriticalNotificationShown")); | 225 content::RecordAction(UserMetricsAction("CriticalNotificationShown")); |
| 228 } | 226 } |
| OLD | NEW |