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" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // How often to refresh the bubble UI to update the counter. As long as the | 40 // How often to refresh the bubble UI to update the counter. As long as the |
41 // countdown is in seconds, this should be 1000 or lower. | 41 // countdown is in seconds, this should be 1000 or lower. |
42 const int kRefreshBubbleEvery = 1000; // Millisecond. | 42 const int kRefreshBubbleEvery = 1000; // Millisecond. |
43 | 43 |
44 } // namespace | 44 } // namespace |
45 | 45 |
46 //////////////////////////////////////////////////////////////////////////////// | 46 //////////////////////////////////////////////////////////////////////////////// |
47 // CriticalNotificationBubbleView | 47 // CriticalNotificationBubbleView |
48 | 48 |
49 CriticalNotificationBubbleView::CriticalNotificationBubbleView( | 49 CriticalNotificationBubbleView::CriticalNotificationBubbleView( |
50 const gfx::Point& anchor_point) | 50 views::View* anchor_view) |
51 : BubbleDelegateView(anchor_point, | 51 : BubbleDelegateView(anchor_view, |
52 views::BubbleBorder::TOP_RIGHT, | 52 views::BubbleBorder::TOP_RIGHT, |
53 SK_ColorWHITE) { | 53 SK_ColorWHITE) { |
54 set_close_on_deactivate(false); | 54 set_close_on_deactivate(false); |
55 } | 55 } |
56 | 56 |
57 CriticalNotificationBubbleView::~CriticalNotificationBubbleView() { | 57 CriticalNotificationBubbleView::~CriticalNotificationBubbleView() { |
58 } | 58 } |
59 | 59 |
60 int CriticalNotificationBubbleView::GetRemainingTime() { | 60 int CriticalNotificationBubbleView::GetRemainingTime() { |
61 base::TimeDelta time_lapsed = base::Time::Now() - bubble_created_; | 61 base::TimeDelta time_lapsed = base::Time::Now() - bubble_created_; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 dismiss_button_ = new views::NativeTextButton(this, UTF16ToWide( | 192 dismiss_button_ = new views::NativeTextButton(this, UTF16ToWide( |
193 l10n_util::GetStringUTF16(IDS_CRITICAL_NOTIFICATION_DISMISS))); | 193 l10n_util::GetStringUTF16(IDS_CRITICAL_NOTIFICATION_DISMISS))); |
194 layout->AddView(dismiss_button_); | 194 layout->AddView(dismiss_button_); |
195 | 195 |
196 refresh_timer_.Start(FROM_HERE, | 196 refresh_timer_.Start(FROM_HERE, |
197 base::TimeDelta::FromMilliseconds(kRefreshBubbleEvery), | 197 base::TimeDelta::FromMilliseconds(kRefreshBubbleEvery), |
198 this, &CriticalNotificationBubbleView::OnCountdown); | 198 this, &CriticalNotificationBubbleView::OnCountdown); |
199 | 199 |
200 UserMetrics::RecordAction(UserMetricsAction("CriticalNotificationShown")); | 200 UserMetrics::RecordAction(UserMetricsAction("CriticalNotificationShown")); |
201 } | 201 } |
OLD | NEW |