| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| 11 #include "chrome/browser/ui/browser_list.h" | 11 #include "chrome/browser/ui/browser_list.h" |
| 12 #include "chrome/browser/upgrade_detector.h" | 12 #include "chrome/browser/upgrade_detector.h" |
| 13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 14 #include "content/browser/user_metrics.h" | 14 #include "content/browser/user_metrics.h" |
| 15 #include "grit/chromium_strings.h" | 15 #include "grit/chromium_strings.h" |
| 16 #include "grit/generated_resources.h" | 16 #include "grit/generated_resources.h" |
| 17 #include "grit/locale_settings.h" | 17 #include "grit/locale_settings.h" |
| 18 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 20 #include "ui/base/models/accelerator.h" |
| 20 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
| 21 #include "views/controls/button/text_button.h" | 22 #include "views/controls/button/text_button.h" |
| 22 #include "views/controls/image_view.h" | 23 #include "views/controls/image_view.h" |
| 23 #include "views/controls/label.h" | 24 #include "views/controls/label.h" |
| 24 #include "views/layout/grid_layout.h" | 25 #include "views/layout/grid_layout.h" |
| 25 #include "views/layout/layout_constants.h" | 26 #include "views/layout/layout_constants.h" |
| 26 #include "views/widget/widget.h" | 27 #include "views/widget/widget.h" |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 115 } |
| 115 | 116 |
| 116 GetWidget()->Close(); | 117 GetWidget()->Close(); |
| 117 } | 118 } |
| 118 | 119 |
| 119 void CriticalNotificationBubbleView::WindowClosing() { | 120 void CriticalNotificationBubbleView::WindowClosing() { |
| 120 refresh_timer_.Stop(); | 121 refresh_timer_.Stop(); |
| 121 } | 122 } |
| 122 | 123 |
| 123 bool CriticalNotificationBubbleView::AcceleratorPressed( | 124 bool CriticalNotificationBubbleView::AcceleratorPressed( |
| 124 const views::Accelerator& accelerator) { | 125 const ui::Accelerator& accelerator) { |
| 125 if (accelerator.key_code() == ui::VKEY_ESCAPE) | 126 if (accelerator.key_code() == ui::VKEY_ESCAPE) |
| 126 UpgradeDetector::GetInstance()->acknowledge_critical_update(); | 127 UpgradeDetector::GetInstance()->acknowledge_critical_update(); |
| 127 return BubbleDelegateView::AcceleratorPressed(accelerator); | 128 return BubbleDelegateView::AcceleratorPressed(accelerator); |
| 128 } | 129 } |
| 129 | 130 |
| 130 void CriticalNotificationBubbleView::Init() { | 131 void CriticalNotificationBubbleView::Init() { |
| 131 bubble_created_ = base::Time::Now(); | 132 bubble_created_ = base::Time::Now(); |
| 132 | 133 |
| 133 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 134 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 134 | 135 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 dismiss_button_ = new views::NativeTextButton(this, UTF16ToWide( | 193 dismiss_button_ = new views::NativeTextButton(this, UTF16ToWide( |
| 193 l10n_util::GetStringUTF16(IDS_CRITICAL_NOTIFICATION_DISMISS))); | 194 l10n_util::GetStringUTF16(IDS_CRITICAL_NOTIFICATION_DISMISS))); |
| 194 layout->AddView(dismiss_button_); | 195 layout->AddView(dismiss_button_); |
| 195 | 196 |
| 196 refresh_timer_.Start(FROM_HERE, | 197 refresh_timer_.Start(FROM_HERE, |
| 197 base::TimeDelta::FromMilliseconds(kRefreshBubbleEvery), | 198 base::TimeDelta::FromMilliseconds(kRefreshBubbleEvery), |
| 198 this, &CriticalNotificationBubbleView::OnCountdown); | 199 this, &CriticalNotificationBubbleView::OnCountdown); |
| 199 | 200 |
| 200 UserMetrics::RecordAction(UserMetricsAction("CriticalNotificationShown")); | 201 UserMetrics::RecordAction(UserMetricsAction("CriticalNotificationShown")); |
| 201 } | 202 } |
| OLD | NEW |