| 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 #ifndef CHROME_BROWSER_UI_VIEWS_CRITICAL_NOTIFICATION_BUBBLE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_CRITICAL_NOTIFICATION_BUBBLE_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_CRITICAL_NOTIFICATION_BUBBLE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_CRITICAL_NOTIFICATION_BUBBLE_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
| 10 #include "ui/views/bubble/bubble_dialog_delegate.h" | 10 #include "ui/views/bubble/bubble_dialog_delegate.h" |
| 11 | 11 |
| 12 class CriticalNotificationBubbleView : public views::BubbleDialogDelegateView { | 12 class CriticalNotificationBubbleView : public views::BubbleDialogDelegateView { |
| 13 public: | 13 public: |
| 14 explicit CriticalNotificationBubbleView(views::View* anchor_view); | 14 explicit CriticalNotificationBubbleView(views::View* anchor_view); |
| 15 ~CriticalNotificationBubbleView() override; | 15 ~CriticalNotificationBubbleView() override; |
| 16 | 16 |
| 17 // views::BubbleDialogDelegateView overrides: | 17 // views::BubbleDialogDelegateView overrides: |
| 18 base::string16 GetWindowTitle() const override; | 18 base::string16 GetWindowTitle() const override; |
| 19 gfx::ImageSkia GetWindowIcon() override; | |
| 20 bool ShouldShowWindowIcon() const override; | |
| 21 void WindowClosing() override; | 19 void WindowClosing() override; |
| 22 bool Cancel() override; | 20 bool Cancel() override; |
| 23 bool Accept() override; | 21 bool Accept() override; |
| 24 void Init() override; | 22 void Init() override; |
| 25 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; | 23 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override; |
| 26 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | 24 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; |
| 27 void ViewHierarchyChanged( | 25 void ViewHierarchyChanged( |
| 28 const ViewHierarchyChangedDetails& details) override; | 26 const ViewHierarchyChangedDetails& details) override; |
| 29 | 27 |
| 30 private: | 28 private: |
| 31 // Helper function to calculate the remaining time (in seconds) until | 29 // Helper function to calculate the remaining time (in seconds) until |
| 32 // spontaneous reboot. | 30 // spontaneous reboot. |
| 33 int GetRemainingTime() const; | 31 int GetRemainingTime() const; |
| 34 | 32 |
| 35 // Called when the timer fires each time the clock ticks. | 33 // Called when the timer fires each time the clock ticks. |
| 36 void OnCountdown(); | 34 void OnCountdown(); |
| 37 | 35 |
| 38 // A timer to refresh the bubble to show new countdown value. | 36 // A timer to refresh the bubble to show new countdown value. |
| 39 base::RepeatingTimer refresh_timer_; | 37 base::RepeatingTimer refresh_timer_; |
| 40 | 38 |
| 41 // When the bubble was created. | 39 // When the bubble was created. |
| 42 base::TimeTicks bubble_created_; | 40 base::TimeTicks bubble_created_; |
| 43 | 41 |
| 44 DISALLOW_COPY_AND_ASSIGN(CriticalNotificationBubbleView); | 42 DISALLOW_COPY_AND_ASSIGN(CriticalNotificationBubbleView); |
| 45 }; | 43 }; |
| 46 | 44 |
| 47 #endif // CHROME_BROWSER_UI_VIEWS_CRITICAL_NOTIFICATION_BUBBLE_VIEW_H_ | 45 #endif // CHROME_BROWSER_UI_VIEWS_CRITICAL_NOTIFICATION_BUBBLE_VIEW_H_ |
| OLD | NEW |