OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/compiler_specific.h" |
12 #include "base/timer.h" | 12 #include "base/timer.h" |
13 #include "chrome/browser/chromeos/status/status_area_button.h" | 13 #include "chrome/browser/chromeos/status/status_area_button.h" |
14 #include "chrome/browser/chromeos/system_key_event_listener.h" | 14 #include "chrome/browser/chromeos/system_key_event_listener.h" |
15 #include "chrome/browser/prefs/pref_member.h" | 15 #include "chrome/browser/prefs/pref_member.h" |
16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
18 #include "ui/views/controls/button/menu_button_delegate.h" | 18 #include "ui/views/controls/button/menu_button_listener.h" |
19 #include "ui/views/controls/menu/menu_delegate.h" | 19 #include "ui/views/controls/menu/menu_delegate.h" |
20 | 20 |
21 class Bubble; | 21 class Bubble; |
22 | 22 |
23 namespace views { | 23 namespace views { |
24 class MenuRunner; | 24 class MenuRunner; |
25 } | 25 } |
26 | 26 |
27 namespace chromeos { | 27 namespace chromeos { |
28 | 28 |
29 class StatusAreaBubbleContentView; | 29 class StatusAreaBubbleContentView; |
30 class StatusAreaBubbleController; | 30 class StatusAreaBubbleController; |
31 | 31 |
32 // A class for the button in the status area which alerts the user when caps | 32 // A class for the button in the status area which alerts the user when caps |
33 // lock is active. | 33 // lock is active. |
34 class CapsLockMenuButton : public content::NotificationObserver, | 34 class CapsLockMenuButton : public content::NotificationObserver, |
35 public StatusAreaButton, | 35 public StatusAreaButton, |
36 public views::MenuDelegate, | 36 public views::MenuDelegate, |
37 public views::MenuButtonDelegate, | 37 public views::MenuButtonListener, |
38 public SystemKeyEventListener::CapsLockObserver { | 38 public SystemKeyEventListener::CapsLockObserver { |
39 public: | 39 public: |
40 explicit CapsLockMenuButton(StatusAreaButton::Delegate* delegate); | 40 explicit CapsLockMenuButton(StatusAreaButton::Delegate* delegate); |
41 virtual ~CapsLockMenuButton(); | 41 virtual ~CapsLockMenuButton(); |
42 | 42 |
43 // views::View implementation. | 43 // views::View implementation. |
44 virtual void OnLocaleChanged() OVERRIDE; | 44 virtual void OnLocaleChanged() OVERRIDE; |
45 | 45 |
46 // views::MenuDelegate implementation. | 46 // views::MenuDelegate implementation. |
47 virtual string16 GetLabel(int id) const OVERRIDE; | 47 virtual string16 GetLabel(int id) const OVERRIDE; |
48 | 48 |
49 // views::MenuButtonDelegate implementation. | 49 // views::MenuButtonListener implementation. |
50 virtual void RunMenu(views::View* unused_source, | 50 virtual void OnMenuButtonClicked(views::View* source, |
51 const gfx::Point& pt) OVERRIDE; | 51 const gfx::Point& point) OVERRIDE; |
52 | 52 |
53 // SystemKeyEventListener::CapsLockObserver implementation | 53 // SystemKeyEventListener::CapsLockObserver implementation |
54 virtual void OnCapsLockChange(bool enabled) OVERRIDE; | 54 virtual void OnCapsLockChange(bool enabled) OVERRIDE; |
55 | 55 |
56 // content::NotificationObserver implementation | 56 // content::NotificationObserver implementation |
57 virtual void Observe(int type, | 57 virtual void Observe(int type, |
58 const content::NotificationSource& source, | 58 const content::NotificationSource& source, |
59 const content::NotificationDetails& details) OVERRIDE; | 59 const content::NotificationDetails& details) OVERRIDE; |
60 | 60 |
61 private: | 61 private: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // # of times |bubble_| is shown. | 100 // # of times |bubble_| is shown. |
101 size_t bubble_count_; | 101 size_t bubble_count_; |
102 // TODO(yusukes): Save should_show_bubble_ and bubble_count_ in Preferences. | 102 // TODO(yusukes): Save should_show_bubble_ and bubble_count_ in Preferences. |
103 | 103 |
104 DISALLOW_COPY_AND_ASSIGN(CapsLockMenuButton); | 104 DISALLOW_COPY_AND_ASSIGN(CapsLockMenuButton); |
105 }; | 105 }; |
106 | 106 |
107 } // namespace chromeos | 107 } // namespace chromeos |
108 | 108 |
109 #endif // CHROME_BROWSER_CHROMEOS_STATUS_CAPS_LOCK_MENU_BUTTON_H_ | 109 #endif // CHROME_BROWSER_CHROMEOS_STATUS_CAPS_LOCK_MENU_BUTTON_H_ |
OLD | NEW |