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_ACCESSIBILITY_MENU_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_STATUS_ACCESSIBILITY_MENU_BUTTON_H_ |
6 #define CHROME_BROWSER_CHROMEOS_STATUS_ACCESSIBILITY_MENU_BUTTON_H_ | 6 #define CHROME_BROWSER_CHROMEOS_STATUS_ACCESSIBILITY_MENU_BUTTON_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/chromeos/status/status_area_button.h" | 9 #include "chrome/browser/chromeos/status/status_area_button.h" |
10 #include "chrome/browser/chromeos/status/status_area_view_chromeos.h" | |
11 #include "chrome/browser/prefs/pref_member.h" | 10 #include "chrome/browser/prefs/pref_member.h" |
12 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
13 #include "views/controls/menu/view_menu_delegate.h" | 12 #include "views/controls/menu/view_menu_delegate.h" |
14 #include "views/controls/menu/menu_delegate.h" | 13 #include "views/controls/menu/menu_delegate.h" |
15 | 14 |
16 namespace views { | 15 namespace views { |
17 class MenuRunner; | 16 class MenuRunner; |
18 } | 17 } |
19 | 18 |
20 namespace chromeos { | 19 namespace chromeos { |
21 | 20 |
22 class StatusAreaBubbleController; | 21 class StatusAreaBubbleController; |
23 | 22 |
24 // A class for the button in the status area which alerts the user when | 23 // A class for the button in the status area which alerts the user when |
25 // accessibility features are enabled. | 24 // accessibility features are enabled. |
26 class AccessibilityMenuButton : public StatusAreaButton, | 25 class AccessibilityMenuButton : public StatusAreaButton, |
27 public views::ViewMenuDelegate, | 26 public views::ViewMenuDelegate, |
28 public views::MenuDelegate, | 27 public views::MenuDelegate, |
29 public content::NotificationObserver { | 28 public content::NotificationObserver { |
30 public: | 29 public: |
31 explicit AccessibilityMenuButton( | 30 explicit AccessibilityMenuButton(StatusAreaButton::Delegate* delegate); |
32 StatusAreaButton::Delegate* delegate, | |
33 StatusAreaViewChromeos::ScreenMode screen_mode); | |
34 virtual ~AccessibilityMenuButton(); | 31 virtual ~AccessibilityMenuButton(); |
35 | 32 |
36 // views::ViewMenuDelegate implementation | 33 // views::ViewMenuDelegate implementation |
37 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; | 34 virtual void RunMenu(views::View* source, const gfx::Point& pt) OVERRIDE; |
38 | 35 |
39 // views::MenuDelegate implementation | 36 // views::MenuDelegate implementation |
40 virtual void ExecuteCommand(int id) OVERRIDE; | 37 virtual void ExecuteCommand(int id) OVERRIDE; |
41 | 38 |
42 // content::NotificationObserver implementation | 39 // content::NotificationObserver implementation |
43 virtual void Observe(int type, | 40 virtual void Observe(int type, |
44 const content::NotificationSource& source, | 41 const content::NotificationSource& source, |
45 const content::NotificationDetails& details) OVERRIDE; | 42 const content::NotificationDetails& details) OVERRIDE; |
46 | 43 |
47 private: | 44 private: |
48 // Updates the state along with the preferences. | 45 // Updates the state along with the preferences. |
49 void Update(); | 46 void Update(); |
50 | 47 |
51 // Prepares menu before showing it. | 48 // Prepares menu before showing it. |
52 void PrepareMenu(); | 49 void PrepareMenu(); |
53 | 50 |
54 StatusAreaViewChromeos::ScreenMode screen_mode_; | |
55 | |
56 // An object synced to the preference, representing if accessibility feature | 51 // An object synced to the preference, representing if accessibility feature |
57 // is enabled or not. | 52 // is enabled or not. |
58 BooleanPrefMember accessibility_enabled_; | 53 BooleanPrefMember accessibility_enabled_; |
59 // An object to show menu. | 54 // An object to show menu. |
60 scoped_ptr<views::MenuRunner> menu_runner_; | 55 scoped_ptr<views::MenuRunner> menu_runner_; |
61 // The currently showing bubble controller. | 56 // The currently showing bubble controller. |
62 scoped_ptr<StatusAreaBubbleController> bubble_controller_; | 57 scoped_ptr<StatusAreaBubbleController> bubble_controller_; |
63 | 58 |
64 DISALLOW_COPY_AND_ASSIGN(AccessibilityMenuButton); | 59 DISALLOW_COPY_AND_ASSIGN(AccessibilityMenuButton); |
65 }; | 60 }; |
66 | 61 |
67 } // namespace chromeos | 62 } // namespace chromeos |
68 | 63 |
69 #endif // CHROME_BROWSER_CHROMEOS_STATUS_ACCESSIBILITY_MENU_BUTTON_H_ | 64 #endif // CHROME_BROWSER_CHROMEOS_STATUS_ACCESSIBILITY_MENU_BUTTON_H_ |
OLD | NEW |