Chromium Code Reviews| 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( | |
| 49 chrome::DialogIdentifier::CRITICAL_UPGRADE_INSTALLED); | |
|
msw
2017/04/07 10:31:09
I vaguely recall this bubble being used for more t
| |
| 47 } | 50 } |
| 48 | 51 |
| 49 CriticalNotificationBubbleView::~CriticalNotificationBubbleView() { | 52 CriticalNotificationBubbleView::~CriticalNotificationBubbleView() { |
| 50 } | 53 } |
| 51 | 54 |
| 52 int CriticalNotificationBubbleView::GetRemainingTime() const { | 55 int CriticalNotificationBubbleView::GetRemainingTime() const { |
| 53 base::TimeDelta time_lapsed = base::TimeTicks::Now() - bubble_created_; | 56 base::TimeDelta time_lapsed = base::TimeTicks::Now() - bubble_created_; |
| 54 return kCountdownDuration - time_lapsed.InSeconds(); | 57 return kCountdownDuration - time_lapsed.InSeconds(); |
| 55 } | 58 } |
| 56 | 59 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 void CriticalNotificationBubbleView::GetAccessibleNodeData( | 143 void CriticalNotificationBubbleView::GetAccessibleNodeData( |
| 141 ui::AXNodeData* node_data) { | 144 ui::AXNodeData* node_data) { |
| 142 node_data->role = ui::AX_ROLE_ALERT; | 145 node_data->role = ui::AX_ROLE_ALERT; |
| 143 } | 146 } |
| 144 | 147 |
| 145 void CriticalNotificationBubbleView::ViewHierarchyChanged( | 148 void CriticalNotificationBubbleView::ViewHierarchyChanged( |
| 146 const ViewHierarchyChangedDetails& details) { | 149 const ViewHierarchyChangedDetails& details) { |
| 147 if (details.is_add && details.child == this) | 150 if (details.is_add && details.child == this) |
| 148 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 151 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
| 149 } | 152 } |
| OLD | NEW |