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

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

Issue 8438064: Separate StatusAreaView from StatusAreaViewChromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 | 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/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/timer.h" 10 #include "base/timer.h"
11 #include "chrome/browser/chromeos/cros/power_library.h"
12 #include "chrome/browser/chromeos/status/status_area_button.h" 11 #include "chrome/browser/chromeos/status/status_area_button.h"
13 #include "chrome/browser/chromeos/system/timezone_settings.h"
14 #include "chrome/browser/prefs/pref_change_registrar.h" 12 #include "chrome/browser/prefs/pref_change_registrar.h"
15 #include "chrome/browser/prefs/pref_member.h" 13 #include "chrome/browser/prefs/pref_member.h"
16 #include "content/public/browser/notification_observer.h" 14 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_types.h" 15 #include "content/public/browser/notification_types.h"
18 #include "unicode/calendar.h" 16 #include "unicode/calendar.h"
19 #include "views/controls/button/menu_button.h" 17 #include "views/controls/button/menu_button.h"
20 #include "views/controls/menu/menu_delegate.h" 18 #include "views/controls/menu/menu_delegate.h"
21 #include "views/controls/menu/view_menu_delegate.h" 19 #include "views/controls/menu/view_menu_delegate.h"
22 20
23 namespace views { 21 namespace views {
24 class MenuRunner; 22 class MenuRunner;
25 } 23 }
26 24
27 namespace chromeos { 25 namespace chromeos {
28 26
29 class StatusAreaHost;
30
31 // The clock menu button in the status area. 27 // The clock menu button in the status area.
32 // This button shows the current time. 28 // This button shows the current time.
33 class ClockMenuButton : public StatusAreaButton, 29 class ClockMenuButton : public StatusAreaButton,
34 public views::MenuDelegate, 30 public views::MenuDelegate,
35 public views::ViewMenuDelegate, 31 public views::ViewMenuDelegate,
36 public content::NotificationObserver, 32 public content::NotificationObserver {
37 public PowerLibrary::Observer,
38 public system::TimezoneSettings::Observer {
39 public: 33 public:
40 explicit ClockMenuButton(StatusAreaHost* host); 34 explicit ClockMenuButton(StatusAreaButton::Delegate* delegate);
41 virtual ~ClockMenuButton(); 35 virtual ~ClockMenuButton();
42 36
43 // views::MenuDelegate implementation 37 // views::MenuDelegate implementation
44 virtual string16 GetLabel(int id) const OVERRIDE; 38 virtual string16 GetLabel(int id) const OVERRIDE;
45 virtual bool IsCommandEnabled(int id) const OVERRIDE; 39 virtual bool IsCommandEnabled(int id) const OVERRIDE;
46 virtual void ExecuteCommand(int id) OVERRIDE; 40 virtual void ExecuteCommand(int id) OVERRIDE;
47 41
48 // Overridden from ResumeLibrary::Observer:
49 virtual void PowerChanged(const PowerSupplyStatus& status) {}
50 virtual void SystemResumed();
51
52 // Overridden from TimezoneSettings::Observer:
53 virtual void TimezoneChanged(const icu::TimeZone& timezone);
54
55 // views::View 42 // views::View
56 virtual void OnLocaleChanged() OVERRIDE; 43 virtual void OnLocaleChanged() OVERRIDE;
57 44
58 // Updates the time on the menu button. Can be called by host if timezone 45 // Updates the time on the menu button.
59 // changes.
60 void UpdateText(); 46 void UpdateText();
61 47
62 // Sets default use 24hour clock mode. 48 // Sets default use 24hour clock mode.
63 void SetDefaultUse24HourClock(bool use_24hour_clock); 49 void SetDefaultUse24HourClock(bool use_24hour_clock);
64 50
65 // content::NotificationObserver implementation. 51 // content::NotificationObserver implementation.
66 virtual void Observe(int type, 52 virtual void Observe(int type,
67 const content::NotificationSource& source, 53 const content::NotificationSource& source,
68 const content::NotificationDetails& details); 54 const content::NotificationDetails& details);
69 55
(...skipping 10 matching lines...) Expand all
80 // Updates text and schedules the timer to fire at the next minute interval. 66 // Updates text and schedules the timer to fire at the next minute interval.
81 void UpdateTextAndSetNextTimer(); 67 void UpdateTextAndSetNextTimer();
82 68
83 base::OneShotTimer<ClockMenuButton> timer_; 69 base::OneShotTimer<ClockMenuButton> timer_;
84 70
85 // The clock menu. 71 // The clock menu.
86 scoped_ptr<views::MenuRunner> menu_runner_; 72 scoped_ptr<views::MenuRunner> menu_runner_;
87 73
88 PrefChangeRegistrar registrar_; 74 PrefChangeRegistrar registrar_;
89 75
90 // Default value for use_24hour_clock. Used when StatusAreaHost does not 76 // Default value for use_24hour_clock.
91 // have a profile, i.e. on login screen and lock screen.
92 bool default_use_24hour_clock_; 77 bool default_use_24hour_clock_;
93 78
94 DISALLOW_COPY_AND_ASSIGN(ClockMenuButton); 79 DISALLOW_COPY_AND_ASSIGN(ClockMenuButton);
95 }; 80 };
96 81
97 } // namespace chromeos 82 } // namespace chromeos
98 83
99 #endif // CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_ 84 #endif // CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698