| 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/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" | 11 #include "chrome/browser/chromeos/cros/power_library.h" |
| 12 #include "chrome/browser/chromeos/status/status_area_button.h" | 12 #include "chrome/browser/chromeos/status/status_area_button.h" |
| 13 #include "chrome/browser/prefs/pref_change_registrar.h" | 13 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 14 #include "chrome/browser/prefs/pref_member.h" | 14 #include "chrome/browser/prefs/pref_member.h" |
| 15 #include "content/common/notification_observer.h" | 15 #include "content/common/notification_observer.h" |
| 16 #include "content/common/notification_type.h" | 16 #include "content/common/notification_type.h" |
| 17 #include "chrome/browser/chromeos/system_access.h" | 17 #include "chrome/browser/chromeos/system/timezone_settings.h" |
| 18 #include "unicode/calendar.h" | 18 #include "unicode/calendar.h" |
| 19 #include "views/controls/button/menu_button.h" | 19 #include "views/controls/button/menu_button.h" |
| 20 #include "views/controls/menu/menu_delegate.h" | 20 #include "views/controls/menu/menu_delegate.h" |
| 21 #include "views/controls/menu/view_menu_delegate.h" | 21 #include "views/controls/menu/view_menu_delegate.h" |
| 22 | 22 |
| 23 namespace views { | 23 namespace views { |
| 24 class MenuItemView; | 24 class MenuItemView; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace chromeos { | 27 namespace chromeos { |
| 28 | 28 |
| 29 class StatusAreaHost; | 29 class StatusAreaHost; |
| 30 | 30 |
| 31 // The clock menu button in the status area. | 31 // The clock menu button in the status area. |
| 32 // This button shows the current time. | 32 // This button shows the current time. |
| 33 class ClockMenuButton : public StatusAreaButton, | 33 class ClockMenuButton : public StatusAreaButton, |
| 34 public views::MenuDelegate, | 34 public views::MenuDelegate, |
| 35 public views::ViewMenuDelegate, | 35 public views::ViewMenuDelegate, |
| 36 public NotificationObserver, | 36 public NotificationObserver, |
| 37 public PowerLibrary::Observer, | 37 public PowerLibrary::Observer, |
| 38 public SystemAccess::Observer { | 38 public system::TimezoneSettings::Observer { |
| 39 public: | 39 public: |
| 40 explicit ClockMenuButton(StatusAreaHost* host); | 40 explicit ClockMenuButton(StatusAreaHost* host); |
| 41 virtual ~ClockMenuButton(); | 41 virtual ~ClockMenuButton(); |
| 42 | 42 |
| 43 // views::MenuDelegate implementation | 43 // views::MenuDelegate implementation |
| 44 virtual std::wstring GetLabel(int id) const OVERRIDE; | 44 virtual std::wstring GetLabel(int id) const OVERRIDE; |
| 45 virtual bool IsCommandEnabled(int id) const OVERRIDE; | 45 virtual bool IsCommandEnabled(int id) const OVERRIDE; |
| 46 virtual void ExecuteCommand(int id) OVERRIDE; | 46 virtual void ExecuteCommand(int id) OVERRIDE; |
| 47 | 47 |
| 48 // Overridden from ResumeLibrary::Observer: | 48 // Overridden from ResumeLibrary::Observer: |
| 49 virtual void PowerChanged(PowerLibrary* obj) {} | 49 virtual void PowerChanged(PowerLibrary* obj) {} |
| 50 virtual void SystemResumed(); | 50 virtual void SystemResumed(); |
| 51 | 51 |
| 52 // Overridden from SystemAccess::Observer: | 52 // Overridden from TimezoneSettings::Observer: |
| 53 virtual void TimezoneChanged(const icu::TimeZone& timezone); | 53 virtual void TimezoneChanged(const icu::TimeZone& timezone); |
| 54 | 54 |
| 55 // views::View | 55 // views::View |
| 56 virtual void OnLocaleChanged() OVERRIDE; | 56 virtual void OnLocaleChanged() OVERRIDE; |
| 57 | 57 |
| 58 // Updates the time on the menu button. Can be called by host if timezone | 58 // Updates the time on the menu button. Can be called by host if timezone |
| 59 // changes. | 59 // changes. |
| 60 void UpdateText(); | 60 void UpdateText(); |
| 61 | 61 |
| 62 // NotificationObserver implementation. | 62 // NotificationObserver implementation. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 85 scoped_ptr<views::MenuItemView> menu_; | 85 scoped_ptr<views::MenuItemView> menu_; |
| 86 | 86 |
| 87 PrefChangeRegistrar registrar_; | 87 PrefChangeRegistrar registrar_; |
| 88 | 88 |
| 89 DISALLOW_COPY_AND_ASSIGN(ClockMenuButton); | 89 DISALLOW_COPY_AND_ASSIGN(ClockMenuButton); |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 } // namespace chromeos | 92 } // namespace chromeos |
| 93 | 93 |
| 94 #endif // CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_ | 94 #endif // CHROME_BROWSER_CHROMEOS_STATUS_CLOCK_MENU_BUTTON_H_ |
| OLD | NEW |