summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/status/caps_lock_menu_button.h
diff options
context:
space:
mode:
authoryusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-18 02:32:13 +0000
committeryusukes@chromium.org <yusukes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-18 02:32:13 +0000
commit0db70f67b5bb0c70c45ed85a983ab9a9188445be (patch)
tree50a45524cb0fb2652916ae28377f3196053e73ae /chrome/browser/chromeos/status/caps_lock_menu_button.h
parent4f4f3f6bdb8ac5461298923757970e071230c810 (diff)
downloadchromium_src-0db70f67b5bb0c70c45ed85a983ab9a9188445be.zip
chromium_src-0db70f67b5bb0c70c45ed85a983ab9a9188445be.tar.gz
chromium_src-0db70f67b5bb0c70c45ed85a983ab9a9188445be.tar.bz2
Implement the final UI for the CAPS LOCK indicator.
- Remove the tooltip - Insted, add a drop-down menu which looks like http://crosbug.com/11690#c18 - Split the string resource for the indicator into two since gfx canvas can not handle a string containing "\n" correctly. - The bubble in the UI mock is NOT implemented yet. BUG=chromium-os:11690 TEST=ran browser_tests Review URL: http://codereview.chromium.org/8249014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106006 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/status/caps_lock_menu_button.h')
-rw-r--r--chrome/browser/chromeos/status/caps_lock_menu_button.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/chrome/browser/chromeos/status/caps_lock_menu_button.h b/chrome/browser/chromeos/status/caps_lock_menu_button.h
index 2960116..f0ca1cd 100644
--- a/chrome/browser/chromeos/status/caps_lock_menu_button.h
+++ b/chrome/browser/chromeos/status/caps_lock_menu_button.h
@@ -12,8 +12,13 @@
#include "chrome/browser/chromeos/system_key_event_listener.h"
#include "chrome/browser/prefs/pref_member.h"
#include "content/common/notification_observer.h"
+#include "views/controls/menu/menu_delegate.h"
#include "views/controls/menu/view_menu_delegate.h"
+namespace views {
+class MenuRunner;
+}
+
namespace chromeos {
class StatusAreaHost;
@@ -22,6 +27,7 @@ class StatusAreaHost;
// lock is active.
class CapsLockMenuButton : public NotificationObserver,
public StatusAreaButton,
+ public views::MenuDelegate,
public views::ViewMenuDelegate,
public SystemKeyEventListener::CapsLockObserver {
public:
@@ -31,6 +37,10 @@ class CapsLockMenuButton : public NotificationObserver,
// views::View implementation.
virtual void OnLocaleChanged();
+ // views::MenuDelegate implementation.
+ virtual string16 GetLabel(int id) const;
+ virtual bool IsCommandEnabled(int id) const;
+
// views::ViewMenuDelegate implementation.
virtual void RunMenu(views::View* unused_source, const gfx::Point& pt);
@@ -42,15 +52,27 @@ class CapsLockMenuButton : public NotificationObserver,
const NotificationSource& source,
const NotificationDetails& details);
- // Updates the tooltip text and the accessible name.
- void UpdateTooltip();
+ // Updates the accessible name.
+ void UpdateAccessibleName();
+
+ // Gets the text for the drop-down menu.
+ string16 GetText() const;
+
// Updates the UI from the current state.
void UpdateUIFromCurrentCapsLock(bool enabled);
private:
+ class StatusView;
+
PrefService* prefs_;
IntegerPrefMember remap_search_key_to_;
+ // The currently showing status view. NULL if menu is not being displayed.
+ StatusView* status_;
+
+ // If non-null the menu is showing.
+ scoped_ptr<views::MenuRunner> menu_runner_;
+
DISALLOW_COPY_AND_ASSIGN(CapsLockMenuButton);
};