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

Side by Side Diff: chrome/browser/chromeos/status/clock_menu_button.h

Issue 8930001: Fix up status area clock code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | Annotate | Revision Log
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_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/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 15 matching lines...) Expand all
26 // The clock menu button in the status area. 26 // The clock menu button in the status area.
27 // This button shows the current time. 27 // This button shows the current time.
28 class ClockMenuButton : public StatusAreaButton, 28 class ClockMenuButton : public StatusAreaButton,
29 public views::MenuDelegate, 29 public views::MenuDelegate,
30 public views::ViewMenuDelegate, 30 public views::ViewMenuDelegate,
31 public content::NotificationObserver { 31 public content::NotificationObserver {
32 public: 32 public:
33 explicit ClockMenuButton(StatusAreaButton::Delegate* delegate); 33 explicit ClockMenuButton(StatusAreaButton::Delegate* delegate);
34 virtual ~ClockMenuButton(); 34 virtual ~ClockMenuButton();
35 35
36 public:
oshima 2011/12/13 06:06:21 remove public:
stevenjb 2011/12/14 02:19:21 Oops. Done.
37 // content::NotificationObserver implementation.
38 virtual void Observe(int type,
39 const content::NotificationSource& source,
40 const content::NotificationDetails& details) OVERRIDE;
41
36 // views::MenuDelegate implementation 42 // views::MenuDelegate implementation
37 virtual string16 GetLabel(int id) const OVERRIDE; 43 virtual string16 GetLabel(int id) const OVERRIDE;
38 virtual bool IsCommandEnabled(int id) const OVERRIDE; 44 virtual bool IsCommandEnabled(int id) const OVERRIDE;
39 virtual void ExecuteCommand(int id) OVERRIDE; 45 virtual void ExecuteCommand(int id) OVERRIDE;
40 46
41 // views::View 47 // Initialize PrefChangeRegistrar with the current default profile.
42 virtual void OnLocaleChanged() OVERRIDE; 48 void UpdateProfile();
43 49
44 // Updates the time on the menu button. 50 // Updates the time on the menu button.
45 void UpdateText(); 51 void UpdateText();
46 52
47 // Sets default use 24hour clock mode.
48 void SetDefaultUse24HourClock(bool use_24hour_clock);
49
50 // content::NotificationObserver implementation.
51 virtual void Observe(int type,
52 const content::NotificationSource& source,
53 const content::NotificationDetails& details) OVERRIDE;
54
55 protected: 53 protected:
54 // StatusAreaButton implementation
55 virtual void SetMenuActive(bool active) OVERRIDE;
56 virtual int horizontal_padding() OVERRIDE; 56 virtual int horizontal_padding() OVERRIDE;
57 57
58 private: 58 // views::View implementation
59 virtual void OnLocaleChanged() OVERRIDE;
60
59 // views::ViewMenuDelegate implementation. 61 // views::ViewMenuDelegate implementation.
60 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; 62 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE;
61 63
64 private:
65 // Sets default use 24hour clock mode.
66 void SetUse24HourClock(bool use_24hour_clock);
67
62 // Create and initialize menu if not already present. 68 // Create and initialize menu if not already present.
63 void EnsureMenu(); 69 void EnsureMenu();
64 70
65 // Updates text and schedules the timer to fire at the next minute interval. 71 // Updates text and schedules the timer to fire at the next minute interval.
66 void UpdateTextAndSetNextTimer(); 72 void UpdateTextAndSetNextTimer();
67 73
68 base::OneShotTimer<ClockMenuButton> timer_; 74 base::OneShotTimer<ClockMenuButton> timer_;
69 75
70 // The clock menu. 76 // The clock menu.
71 scoped_ptr<views::MenuRunner> menu_runner_; 77 scoped_ptr<views::MenuRunner> menu_runner_;
72 78
73 PrefChangeRegistrar registrar_; 79 PrefService* pref_service_;
80 scoped_ptr<PrefChangeRegistrar> registrar_;
74 81
75 // Default value for use_24hour_clock. 82 // Cached value for use_24hour_clock.
76 bool default_use_24hour_clock_; 83 bool use_24hour_clock_;
77 84
78 DISALLOW_COPY_AND_ASSIGN(ClockMenuButton); 85 DISALLOW_COPY_AND_ASSIGN(ClockMenuButton);
79 }; 86 };
80 87
81 #endif // CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_ 88 #endif // CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698