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 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_ |
6 #define CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_ | 6 #define CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
10 #include "base/timer.h" | 11 #include "base/timer.h" |
11 #include "chrome/browser/chromeos/status/status_area_button.h" | 12 #include "chrome/browser/chromeos/status/status_area_button.h" |
12 #include "chrome/browser/prefs/pref_change_registrar.h" | 13 #include "chrome/browser/prefs/pref_change_registrar.h" |
13 #include "chrome/browser/prefs/pref_member.h" | 14 #include "chrome/browser/prefs/pref_member.h" |
14 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
15 #include "content/public/browser/notification_types.h" | 16 #include "content/public/browser/notification_types.h" |
16 #include "unicode/calendar.h" | 17 #include "unicode/calendar.h" |
17 #include "views/controls/button/menu_button.h" | 18 #include "views/controls/button/menu_button.h" |
18 #include "views/controls/menu/menu_delegate.h" | 19 #include "views/controls/menu/menu_delegate.h" |
(...skipping 23 matching lines...) Expand all Loading... |
42 | 43 |
43 // Updates the time on the menu button. | 44 // Updates the time on the menu button. |
44 void UpdateText(); | 45 void UpdateText(); |
45 | 46 |
46 // Sets default use 24hour clock mode. | 47 // Sets default use 24hour clock mode. |
47 void SetDefaultUse24HourClock(bool use_24hour_clock); | 48 void SetDefaultUse24HourClock(bool use_24hour_clock); |
48 | 49 |
49 // content::NotificationObserver implementation. | 50 // content::NotificationObserver implementation. |
50 virtual void Observe(int type, | 51 virtual void Observe(int type, |
51 const content::NotificationSource& source, | 52 const content::NotificationSource& source, |
52 const content::NotificationDetails& details); | 53 const content::NotificationDetails& details) OVERRIDE; |
53 | 54 |
54 protected: | 55 protected: |
55 virtual int horizontal_padding(); | 56 virtual int horizontal_padding() OVERRIDE; |
56 | 57 |
57 private: | 58 private: |
58 // views::ViewMenuDelegate implementation. | 59 // views::ViewMenuDelegate implementation. |
59 virtual void RunMenu(views::View* source, const gfx::Point& pt); | 60 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; |
60 | 61 |
61 // Create and initialize menu if not already present. | 62 // Create and initialize menu if not already present. |
62 void EnsureMenu(); | 63 void EnsureMenu(); |
63 | 64 |
64 // Updates text and schedules the timer to fire at the next minute interval. | 65 // Updates text and schedules the timer to fire at the next minute interval. |
65 void UpdateTextAndSetNextTimer(); | 66 void UpdateTextAndSetNextTimer(); |
66 | 67 |
67 base::OneShotTimer<ClockMenuButton> timer_; | 68 base::OneShotTimer<ClockMenuButton> timer_; |
68 | 69 |
69 // The clock menu. | 70 // The clock menu. |
70 scoped_ptr<views::MenuRunner> menu_runner_; | 71 scoped_ptr<views::MenuRunner> menu_runner_; |
71 | 72 |
72 PrefChangeRegistrar registrar_; | 73 PrefChangeRegistrar registrar_; |
73 | 74 |
74 // Default value for use_24hour_clock. | 75 // Default value for use_24hour_clock. |
75 bool default_use_24hour_clock_; | 76 bool default_use_24hour_clock_; |
76 | 77 |
77 DISALLOW_COPY_AND_ASSIGN(ClockMenuButton); | 78 DISALLOW_COPY_AND_ASSIGN(ClockMenuButton); |
78 }; | 79 }; |
79 | 80 |
80 #endif // CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_ | 81 #endif // CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_ |
OLD | NEW |