| OLD | NEW |
| (Empty) |
| 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 | |
| 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/public/browser/notification_observer.h" | |
| 12 #include "ui/views/controls/button/menu_button_listener.h" | |
| 13 #include "ui/views/controls/menu/menu_delegate.h" | |
| 14 | |
| 15 namespace views { | |
| 16 class MenuRunner; | |
| 17 } | |
| 18 | |
| 19 namespace chromeos { | |
| 20 | |
| 21 class StatusAreaBubbleController; | |
| 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::MenuButtonListener, | |
| 27 public views::MenuDelegate, | |
| 28 public content::NotificationObserver { | |
| 29 public: | |
| 30 explicit AccessibilityMenuButton(StatusAreaButton::Delegate* delegate); | |
| 31 virtual ~AccessibilityMenuButton(); | |
| 32 | |
| 33 // Overridden from views::MenuButtonListener: | |
| 34 virtual void OnMenuButtonClicked(views::View* source, | |
| 35 const gfx::Point& point) OVERRIDE; | |
| 36 | |
| 37 // Overridden from views::MenuDelegate: | |
| 38 virtual void ExecuteCommand(int id) OVERRIDE; | |
| 39 | |
| 40 // content::NotificationObserver implementation | |
| 41 virtual void Observe(int type, | |
| 42 const content::NotificationSource& source, | |
| 43 const content::NotificationDetails& details) OVERRIDE; | |
| 44 | |
| 45 private: | |
| 46 // Updates the state along with the preferences. | |
| 47 void Update(); | |
| 48 | |
| 49 // Prepares menu before showing it. | |
| 50 void PrepareMenu(); | |
| 51 | |
| 52 // An object synced to the preference, representing if accessibility feature | |
| 53 // is enabled or not. | |
| 54 BooleanPrefMember accessibility_enabled_; | |
| 55 // An object to show menu. | |
| 56 scoped_ptr<views::MenuRunner> menu_runner_; | |
| 57 // The currently showing bubble controller. | |
| 58 scoped_ptr<StatusAreaBubbleController> bubble_controller_; | |
| 59 | |
| 60 DISALLOW_COPY_AND_ASSIGN(AccessibilityMenuButton); | |
| 61 }; | |
| 62 | |
| 63 } // namespace chromeos | |
| 64 | |
| 65 #endif // CHROME_BROWSER_CHROMEOS_STATUS_ACCESSIBILITY_MENU_BUTTON_H_ | |
| OLD | NEW |