| 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/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 //////////////////////////////////////////////////////////////////////////////// | 50 //////////////////////////////////////////////////////////////////////////////// |
| 51 // CriticalNotificationBubbleView | 51 // CriticalNotificationBubbleView |
| 52 | 52 |
| 53 CriticalNotificationBubbleView::CriticalNotificationBubbleView( | 53 CriticalNotificationBubbleView::CriticalNotificationBubbleView( |
| 54 views::View* anchor_view) | 54 views::View* anchor_view) |
| 55 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), | 55 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), |
| 56 headline_(NULL), | 56 headline_(NULL), |
| 57 restart_button_(NULL), | 57 restart_button_(NULL), |
| 58 dismiss_button_(NULL) { | 58 dismiss_button_(NULL) { |
| 59 set_close_on_deactivate(false); | 59 set_close_on_deactivate(false); |
| 60 set_move_with_anchor(true); |
| 60 } | 61 } |
| 61 | 62 |
| 62 CriticalNotificationBubbleView::~CriticalNotificationBubbleView() { | 63 CriticalNotificationBubbleView::~CriticalNotificationBubbleView() { |
| 63 } | 64 } |
| 64 | 65 |
| 65 int CriticalNotificationBubbleView::GetRemainingTime() { | 66 int CriticalNotificationBubbleView::GetRemainingTime() { |
| 66 base::TimeDelta time_lapsed = base::Time::Now() - bubble_created_; | 67 base::TimeDelta time_lapsed = base::Time::Now() - bubble_created_; |
| 67 return kCountdownDuration - time_lapsed.InSeconds(); | 68 return kCountdownDuration - time_lapsed.InSeconds(); |
| 68 } | 69 } |
| 69 | 70 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 dismiss_button_ = new views::NativeTextButton(this, UTF16ToWide( | 220 dismiss_button_ = new views::NativeTextButton(this, UTF16ToWide( |
| 220 l10n_util::GetStringUTF16(IDS_CRITICAL_NOTIFICATION_DISMISS))); | 221 l10n_util::GetStringUTF16(IDS_CRITICAL_NOTIFICATION_DISMISS))); |
| 221 layout->AddView(dismiss_button_); | 222 layout->AddView(dismiss_button_); |
| 222 | 223 |
| 223 refresh_timer_.Start(FROM_HERE, | 224 refresh_timer_.Start(FROM_HERE, |
| 224 base::TimeDelta::FromMilliseconds(kRefreshBubbleEvery), | 225 base::TimeDelta::FromMilliseconds(kRefreshBubbleEvery), |
| 225 this, &CriticalNotificationBubbleView::OnCountdown); | 226 this, &CriticalNotificationBubbleView::OnCountdown); |
| 226 | 227 |
| 227 content::RecordAction(UserMetricsAction("CriticalNotificationShown")); | 228 content::RecordAction(UserMetricsAction("CriticalNotificationShown")); |
| 228 } | 229 } |
| OLD | NEW |