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/compiler_specific.h" |
11 #include "base/timer.h" | 12 #include "base/timer.h" |
12 #include "chrome/browser/chromeos/status/status_area_button.h" | 13 #include "chrome/browser/chromeos/status/status_area_button.h" |
13 #include "chrome/browser/chromeos/system_key_event_listener.h" | 14 #include "chrome/browser/chromeos/system_key_event_listener.h" |
14 #include "chrome/browser/prefs/pref_member.h" | 15 #include "chrome/browser/prefs/pref_member.h" |
15 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
16 #include "views/controls/menu/menu_delegate.h" | 17 #include "views/controls/menu/menu_delegate.h" |
17 #include "views/controls/menu/view_menu_delegate.h" | 18 #include "views/controls/menu/view_menu_delegate.h" |
18 | 19 |
19 class Bubble; | 20 class Bubble; |
20 | 21 |
(...skipping 11 matching lines...) Expand all Loading... |
32 class CapsLockMenuButton : public content::NotificationObserver, | 33 class CapsLockMenuButton : public content::NotificationObserver, |
33 public StatusAreaButton, | 34 public StatusAreaButton, |
34 public views::MenuDelegate, | 35 public views::MenuDelegate, |
35 public views::ViewMenuDelegate, | 36 public views::ViewMenuDelegate, |
36 public SystemKeyEventListener::CapsLockObserver { | 37 public SystemKeyEventListener::CapsLockObserver { |
37 public: | 38 public: |
38 explicit CapsLockMenuButton(StatusAreaButton::Delegate* delegate); | 39 explicit CapsLockMenuButton(StatusAreaButton::Delegate* delegate); |
39 virtual ~CapsLockMenuButton(); | 40 virtual ~CapsLockMenuButton(); |
40 | 41 |
41 // views::View implementation. | 42 // views::View implementation. |
42 virtual void OnLocaleChanged(); | 43 virtual void OnLocaleChanged() OVERRIDE; |
43 | 44 |
44 // views::MenuDelegate implementation. | 45 // views::MenuDelegate implementation. |
45 virtual string16 GetLabel(int id) const; | 46 virtual string16 GetLabel(int id) const OVERRIDE; |
46 | 47 |
47 // views::ViewMenuDelegate implementation. | 48 // views::ViewMenuDelegate implementation. |
48 virtual void RunMenu(views::View* unused_source, const gfx::Point& pt); | 49 virtual void RunMenu(views::View* unused_source, |
| 50 const gfx::Point& pt) OVERRIDE; |
49 | 51 |
50 // SystemKeyEventListener::CapsLockObserver implementation | 52 // SystemKeyEventListener::CapsLockObserver implementation |
51 virtual void OnCapsLockChange(bool enabled); | 53 virtual void OnCapsLockChange(bool enabled) OVERRIDE; |
52 | 54 |
53 // content::NotificationObserver implementation | 55 // content::NotificationObserver implementation |
54 virtual void Observe(int type, | 56 virtual void Observe(int type, |
55 const content::NotificationSource& source, | 57 const content::NotificationSource& source, |
56 const content::NotificationDetails& details); | 58 const content::NotificationDetails& details) OVERRIDE; |
57 | 59 |
58 private: | 60 private: |
59 // Returns true if the Search key is assigned to Caps Lock. | 61 // Returns true if the Search key is assigned to Caps Lock. |
60 bool HasCapsLock() const; | 62 bool HasCapsLock() const; |
61 | 63 |
62 bool IsMenuShown() const; | 64 bool IsMenuShown() const; |
63 void HideMenu(); | 65 void HideMenu(); |
64 | 66 |
65 bool IsBubbleShown() const; | 67 bool IsBubbleShown() const; |
66 void MaybeShowBubble(); | 68 void MaybeShowBubble(); |
(...skipping 25 matching lines...) Expand all Loading... |
92 // # of times |bubble_| is shown. | 94 // # of times |bubble_| is shown. |
93 size_t bubble_count_; | 95 size_t bubble_count_; |
94 // TODO(yusukes): Save should_show_bubble_ and bubble_count_ in Preferences. | 96 // TODO(yusukes): Save should_show_bubble_ and bubble_count_ in Preferences. |
95 | 97 |
96 DISALLOW_COPY_AND_ASSIGN(CapsLockMenuButton); | 98 DISALLOW_COPY_AND_ASSIGN(CapsLockMenuButton); |
97 }; | 99 }; |
98 | 100 |
99 } // namespace chromeos | 101 } // namespace chromeos |
100 | 102 |
101 #endif // CHROME_BROWSER_CHROMEOS_STATUS_CAPS_LOCK_MENU_BUTTON_H_ | 103 #endif // CHROME_BROWSER_CHROMEOS_STATUS_CAPS_LOCK_MENU_BUTTON_H_ |
OLD | NEW |