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