Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / ui / views / critical_notification_bubble_view.h
blobf387c29ff178366ca769b7b01a01ed2a8ff90414
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_CRITICAL_NOTIFICATION_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_CRITICAL_NOTIFICATION_BUBBLE_VIEW_H_
8 #include "base/timer/timer.h"
9 #include "ui/views/bubble/bubble_delegate.h"
10 #include "ui/views/controls/button/button.h"
12 namespace ui {
13 class Accelerator;
16 namespace views {
17 class Label;
18 class LabelButton;
21 class CriticalNotificationBubbleView : public views::BubbleDelegateView,
22 public views::ButtonListener {
23 public:
24 explicit CriticalNotificationBubbleView(views::View* anchor_view);
25 virtual ~CriticalNotificationBubbleView();
27 // views::ButtonListener overrides:
28 virtual void ButtonPressed(views::Button* sender,
29 const ui::Event& event) OVERRIDE;
31 // views::WidgetDelegate overrides:
32 virtual void WindowClosing() OVERRIDE;
34 // views::View overrides:
35 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
36 virtual void ViewHierarchyChanged(
37 const ViewHierarchyChangedDetails& details) OVERRIDE;
39 protected:
40 // views::BubbleDelegateView overrides:
41 virtual bool AcceleratorPressed(
42 const ui::Accelerator& accelerator) OVERRIDE;
43 virtual void Init() OVERRIDE;
45 private:
46 // Helper function to calculate the remaining time (in seconds) until
47 // spontaneous reboot.
48 int GetRemainingTime();
50 // Helper function to set the headline for the bubble.
51 void UpdateBubbleHeadline(int seconds);
53 // Called when the timer fires each time the clock ticks.
54 void OnCountdown();
56 // The headline and buttons on the bubble.
57 views::Label* headline_;
58 views::LabelButton* restart_button_;
59 views::LabelButton* dismiss_button_;
61 // A timer to refresh the bubble to show new countdown value.
62 base::RepeatingTimer<CriticalNotificationBubbleView> refresh_timer_;
64 // When the bubble was created.
65 base::Time bubble_created_;
67 DISALLOW_COPY_AND_ASSIGN(CriticalNotificationBubbleView);
70 #endif // CHROME_BROWSER_UI_VIEWS_CRITICAL_NOTIFICATION_BUBBLE_VIEW_H_