Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: chrome/browser/chromeos/status/caps_lock_menu_button.h

Issue 8330016: Implement the final UI for the CAPS LOCK indicator (part 3 of 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/status/caps_lock_menu_button.h
diff --git a/chrome/browser/chromeos/status/caps_lock_menu_button.h b/chrome/browser/chromeos/status/caps_lock_menu_button.h
index f0ca1cd7e7ac31a0e9836219dd07e9540cf0d909..6c91acaa6ba6ef1705b07aef838b8e8aa334c643 100644
--- a/chrome/browser/chromeos/status/caps_lock_menu_button.h
+++ b/chrome/browser/chromeos/status/caps_lock_menu_button.h
@@ -8,6 +8,7 @@
#include <string>
+#include "base/timer.h"
#include "chrome/browser/chromeos/status/status_area_button.h"
#include "chrome/browser/chromeos/system_key_event_listener.h"
#include "chrome/browser/prefs/pref_member.h"
@@ -15,6 +16,8 @@
#include "views/controls/menu/menu_delegate.h"
#include "views/controls/menu/view_menu_delegate.h"
+class Bubble;
+
namespace views {
class MenuRunner;
}
@@ -55,24 +58,45 @@ class CapsLockMenuButton : public NotificationObserver,
// Updates the accessible name.
void UpdateAccessibleName();
- // Gets the text for the drop-down menu.
+ // Gets the text for the drop-down menu and bubble.
string16 GetText() const;
- // Updates the UI from the current state.
+ // Updates the button from the current state.
void UpdateUIFromCurrentCapsLock(bool enabled);
private:
class StatusView;
+ // Returns true if the Search key is assigned to Caps Lock.
+ bool HasCapsLock() const;
+
+ bool IsMenuShown() const;
+ void HideMenu();
+
+ bool IsBubbleShown() const;
+ void MaybeShowBubble();
+ void CreateAndShowBubble();
+ void HideBubble();
+
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_;
+ // The currently showing bubble. NULL if bubble is not being displayed.
+ Bubble* bubble_;
+ // If true, |bubble_| is shown when both shift keys are pressed.
+ bool should_show_bubble_;
+ // # of times |bubble_| is shown.
+ size_t bubble_count_;
+ // TODO(yusukes): Save should_show_bubble_ and bubble_count_ in Preferences.
+
+ // The timer for hiding the bubble.
+ base::OneShotTimer<CapsLockMenuButton> bubble_timer_;
+
DISALLOW_COPY_AND_ASSIGN(CapsLockMenuButton);
};

Powered by Google App Engine
This is Rietveld 408576698