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