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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // countdown is in seconds, this should be 1000 or lower. | 42 // countdown is in seconds, this should be 1000 or lower. |
43 const int kRefreshBubbleEvery = 1000; // Millisecond. | 43 const int kRefreshBubbleEvery = 1000; // Millisecond. |
44 | 44 |
45 } // namespace | 45 } // namespace |
46 | 46 |
47 //////////////////////////////////////////////////////////////////////////////// | 47 //////////////////////////////////////////////////////////////////////////////// |
48 // CriticalNotificationBubbleView | 48 // CriticalNotificationBubbleView |
49 | 49 |
50 CriticalNotificationBubbleView::CriticalNotificationBubbleView( | 50 CriticalNotificationBubbleView::CriticalNotificationBubbleView( |
51 views::View* anchor_view) | 51 views::View* anchor_view) |
52 : BubbleDelegateView(anchor_view, | 52 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT) { |
53 views::BubbleBorder::TOP_RIGHT, | |
54 SK_ColorWHITE) { | |
55 set_close_on_deactivate(false); | 53 set_close_on_deactivate(false); |
56 } | 54 } |
57 | 55 |
58 CriticalNotificationBubbleView::~CriticalNotificationBubbleView() { | 56 CriticalNotificationBubbleView::~CriticalNotificationBubbleView() { |
59 } | 57 } |
60 | 58 |
61 int CriticalNotificationBubbleView::GetRemainingTime() { | 59 int CriticalNotificationBubbleView::GetRemainingTime() { |
62 base::TimeDelta time_lapsed = base::Time::Now() - bubble_created_; | 60 base::TimeDelta time_lapsed = base::Time::Now() - bubble_created_; |
63 return kCountdownDuration - time_lapsed.InSeconds(); | 61 return kCountdownDuration - time_lapsed.InSeconds(); |
64 } | 62 } |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 dismiss_button_ = new views::NativeTextButton(this, UTF16ToWide( | 191 dismiss_button_ = new views::NativeTextButton(this, UTF16ToWide( |
194 l10n_util::GetStringUTF16(IDS_CRITICAL_NOTIFICATION_DISMISS))); | 192 l10n_util::GetStringUTF16(IDS_CRITICAL_NOTIFICATION_DISMISS))); |
195 layout->AddView(dismiss_button_); | 193 layout->AddView(dismiss_button_); |
196 | 194 |
197 refresh_timer_.Start(FROM_HERE, | 195 refresh_timer_.Start(FROM_HERE, |
198 base::TimeDelta::FromMilliseconds(kRefreshBubbleEvery), | 196 base::TimeDelta::FromMilliseconds(kRefreshBubbleEvery), |
199 this, &CriticalNotificationBubbleView::OnCountdown); | 197 this, &CriticalNotificationBubbleView::OnCountdown); |
200 | 198 |
201 UserMetrics::RecordAction(UserMetricsAction("CriticalNotificationShown")); | 199 UserMetrics::RecordAction(UserMetricsAction("CriticalNotificationShown")); |
202 } | 200 } |
OLD | NEW |