| 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/metrics/user_metrics.h" | 7 #include "base/metrics/user_metrics.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/ui/browser_dialogs.h" |
| 11 #include "chrome/browser/upgrade_detector.h" | 12 #include "chrome/browser/upgrade_detector.h" |
| 12 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 13 #include "chrome/grit/chromium_strings.h" | 14 #include "chrome/grit/chromium_strings.h" |
| 14 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 15 #include "chrome/grit/locale_settings.h" | 16 #include "chrome/grit/locale_settings.h" |
| 16 #include "chrome/grit/theme_resources.h" | 17 #include "chrome/grit/theme_resources.h" |
| 17 #include "components/prefs/pref_service.h" | 18 #include "components/prefs/pref_service.h" |
| 18 #include "ui/accessibility/ax_node_data.h" | 19 #include "ui/accessibility/ax_node_data.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 20 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 37 | 38 |
| 38 } // namespace | 39 } // namespace |
| 39 | 40 |
| 40 //////////////////////////////////////////////////////////////////////////////// | 41 //////////////////////////////////////////////////////////////////////////////// |
| 41 // CriticalNotificationBubbleView | 42 // CriticalNotificationBubbleView |
| 42 | 43 |
| 43 CriticalNotificationBubbleView::CriticalNotificationBubbleView( | 44 CriticalNotificationBubbleView::CriticalNotificationBubbleView( |
| 44 views::View* anchor_view) | 45 views::View* anchor_view) |
| 45 : BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT) { | 46 : BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT) { |
| 46 set_close_on_deactivate(false); | 47 set_close_on_deactivate(false); |
| 48 chrome::RecordDialogCreation(chrome::DialogIdentifier::CRITICAL_NOTIFICATION); |
| 47 } | 49 } |
| 48 | 50 |
| 49 CriticalNotificationBubbleView::~CriticalNotificationBubbleView() { | 51 CriticalNotificationBubbleView::~CriticalNotificationBubbleView() { |
| 50 } | 52 } |
| 51 | 53 |
| 52 int CriticalNotificationBubbleView::GetRemainingTime() const { | 54 int CriticalNotificationBubbleView::GetRemainingTime() const { |
| 53 base::TimeDelta time_lapsed = base::TimeTicks::Now() - bubble_created_; | 55 base::TimeDelta time_lapsed = base::TimeTicks::Now() - bubble_created_; |
| 54 return kCountdownDuration - time_lapsed.InSeconds(); | 56 return kCountdownDuration - time_lapsed.InSeconds(); |
| 55 } | 57 } |
| 56 | 58 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 void CriticalNotificationBubbleView::GetAccessibleNodeData( | 142 void CriticalNotificationBubbleView::GetAccessibleNodeData( |
| 141 ui::AXNodeData* node_data) { | 143 ui::AXNodeData* node_data) { |
| 142 node_data->role = ui::AX_ROLE_ALERT; | 144 node_data->role = ui::AX_ROLE_ALERT; |
| 143 } | 145 } |
| 144 | 146 |
| 145 void CriticalNotificationBubbleView::ViewHierarchyChanged( | 147 void CriticalNotificationBubbleView::ViewHierarchyChanged( |
| 146 const ViewHierarchyChangedDetails& details) { | 148 const ViewHierarchyChangedDetails& details) { |
| 147 if (details.is_add && details.child == this) | 149 if (details.is_add && details.child == this) |
| 148 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 150 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 149 } | 151 } |
| OLD | NEW |