Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: chrome/browser/ui/views/critical_notification_bubble_view.h

Issue 8508055: Move views::Accelerator to ui in order to use it from aura code. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #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 #pragma once 7 #pragma once
8 8
9 #include "base/timer.h" 9 #include "base/timer.h"
10 #include "views/controls/button/button.h" 10 #include "views/controls/button/button.h"
11 #include "views/bubble/bubble_delegate.h" 11 #include "views/bubble/bubble_delegate.h"
12 12
13 namespace ui {
14 class Accelerator;
15 }
16
13 namespace views { 17 namespace views {
14 class Label; 18 class Label;
15 class NativeTextButton; 19 class NativeTextButton;
16 } 20 }
17 21
18 class CriticalNotificationBubbleView : public views::BubbleDelegateView, 22 class CriticalNotificationBubbleView : public views::BubbleDelegateView,
19 public views::ButtonListener { 23 public views::ButtonListener {
20 public: 24 public:
21 explicit CriticalNotificationBubbleView(views::View* anchor_view); 25 explicit CriticalNotificationBubbleView(views::View* anchor_view);
22 virtual ~CriticalNotificationBubbleView(); 26 virtual ~CriticalNotificationBubbleView();
23 27
24 // views::ButtonListener overrides: 28 // views::ButtonListener overrides:
25 virtual void ButtonPressed(views::Button* sender, 29 virtual void ButtonPressed(views::Button* sender,
26 const views::Event& event) OVERRIDE; 30 const views::Event& event) OVERRIDE;
27 31
28 // views::WidgetDelegate overrides: 32 // views::WidgetDelegate overrides:
29 virtual void WindowClosing() OVERRIDE; 33 virtual void WindowClosing() OVERRIDE;
30 34
31 protected: 35 protected:
32 // views::BubbleDelegateView overrides: 36 // views::BubbleDelegateView overrides:
33 virtual bool AcceleratorPressed( 37 virtual bool AcceleratorPressed(
34 const views::Accelerator& accelerator) OVERRIDE; 38 const ui::Accelerator& accelerator) OVERRIDE;
35 virtual void Init() OVERRIDE; 39 virtual void Init() OVERRIDE;
36 40
37 private: 41 private:
38 // Helper function to calculate the remaining time (in seconds) until 42 // Helper function to calculate the remaining time (in seconds) until
39 // spontaneous reboot. 43 // spontaneous reboot.
40 int GetRemainingTime(); 44 int GetRemainingTime();
41 45
42 // Helper function to set the headline for the bubble. 46 // Helper function to set the headline for the bubble.
43 void UpdateBubbleHeadline(int seconds); 47 void UpdateBubbleHeadline(int seconds);
44 48
45 // Called when the timer fires each time the clock ticks. 49 // Called when the timer fires each time the clock ticks.
46 void OnCountdown(); 50 void OnCountdown();
47 51
48 // The headline and buttons on the bubble. 52 // The headline and buttons on the bubble.
49 views::Label* headline_; 53 views::Label* headline_;
50 views::NativeTextButton* restart_button_; 54 views::NativeTextButton* restart_button_;
51 views::NativeTextButton* dismiss_button_; 55 views::NativeTextButton* dismiss_button_;
52 56
53 // A timer to refresh the bubble to show new countdown value. 57 // A timer to refresh the bubble to show new countdown value.
54 base::RepeatingTimer<CriticalNotificationBubbleView> refresh_timer_; 58 base::RepeatingTimer<CriticalNotificationBubbleView> refresh_timer_;
55 59
56 // When the bubble was created. 60 // When the bubble was created.
57 base::Time bubble_created_; 61 base::Time bubble_created_;
58 62
59 DISALLOW_COPY_AND_ASSIGN(CriticalNotificationBubbleView); 63 DISALLOW_COPY_AND_ASSIGN(CriticalNotificationBubbleView);
60 }; 64 };
61 65
62 #endif // CHROME_BROWSER_UI_VIEWS_CRITICAL_NOTIFICATION_BUBBLE_VIEW_H_ 66 #endif // CHROME_BROWSER_UI_VIEWS_CRITICAL_NOTIFICATION_BUBBLE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698