| 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_CAPS_LOCK_MENU_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_CAPS_LOCK_MENU_BUTTON_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_STATUS_CAPS_LOCK_MENU_BUTTON_H_ | 6 #define CHROME_BROWSER_CHROMEOS_STATUS_CAPS_LOCK_MENU_BUTTON_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/timer.h" | 11 #include "base/timer.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/chromeos/system_key_event_listener.h" | 13 #include "chrome/browser/chromeos/system_key_event_listener.h" |
| 14 #include "chrome/browser/prefs/pref_member.h" | 14 #include "chrome/browser/prefs/pref_member.h" |
| 15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
| 16 #include "views/controls/menu/menu_delegate.h" | 16 #include "views/controls/menu/menu_delegate.h" |
| 17 #include "views/controls/menu/view_menu_delegate.h" | 17 #include "views/controls/menu/view_menu_delegate.h" |
| 18 | 18 |
| 19 class Bubble; | 19 class Bubble; |
| 20 | 20 |
| 21 namespace views { | 21 namespace views { |
| 22 class MenuRunner; | 22 class MenuRunner; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace chromeos { | 25 namespace chromeos { |
| 26 | 26 |
| 27 class StatusAreaHost; | |
| 28 | |
| 29 // A class for the button in the status area which alerts the user when caps | 27 // A class for the button in the status area which alerts the user when caps |
| 30 // lock is active. | 28 // lock is active. |
| 31 class CapsLockMenuButton : public content::NotificationObserver, | 29 class CapsLockMenuButton : public content::NotificationObserver, |
| 32 public StatusAreaButton, | 30 public StatusAreaButton, |
| 33 public views::MenuDelegate, | 31 public views::MenuDelegate, |
| 34 public views::ViewMenuDelegate, | 32 public views::ViewMenuDelegate, |
| 35 public SystemKeyEventListener::CapsLockObserver { | 33 public SystemKeyEventListener::CapsLockObserver { |
| 36 public: | 34 public: |
| 37 explicit CapsLockMenuButton(StatusAreaHost* host); | 35 explicit CapsLockMenuButton(StatusAreaButton::Delegate* delegate); |
| 38 virtual ~CapsLockMenuButton(); | 36 virtual ~CapsLockMenuButton(); |
| 39 | 37 |
| 40 // views::View implementation. | 38 // views::View implementation. |
| 41 virtual void OnLocaleChanged(); | 39 virtual void OnLocaleChanged(); |
| 42 | 40 |
| 43 // views::MenuDelegate implementation. | 41 // views::MenuDelegate implementation. |
| 44 virtual string16 GetLabel(int id) const; | 42 virtual string16 GetLabel(int id) const; |
| 45 virtual bool IsCommandEnabled(int id) const; | 43 virtual bool IsCommandEnabled(int id) const; |
| 46 | 44 |
| 47 // views::ViewMenuDelegate implementation. | 45 // views::ViewMenuDelegate implementation. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 94 |
| 97 // The timer for hiding the bubble. | 95 // The timer for hiding the bubble. |
| 98 base::OneShotTimer<CapsLockMenuButton> bubble_timer_; | 96 base::OneShotTimer<CapsLockMenuButton> bubble_timer_; |
| 99 | 97 |
| 100 DISALLOW_COPY_AND_ASSIGN(CapsLockMenuButton); | 98 DISALLOW_COPY_AND_ASSIGN(CapsLockMenuButton); |
| 101 }; | 99 }; |
| 102 | 100 |
| 103 } // namespace chromeos | 101 } // namespace chromeos |
| 104 | 102 |
| 105 #endif // CHROME_BROWSER_CHROMEOS_STATUS_CAPS_LOCK_MENU_BUTTON_H_ | 103 #endif // CHROME_BROWSER_CHROMEOS_STATUS_CAPS_LOCK_MENU_BUTTON_H_ |
| OLD | NEW |