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

Unified Diff: ash/common/system/tray/system_tray.h

Issue 2330403002: Do not activate system tray bubble by default (Closed)
Patch Set: Do not activate system tray bubble by default Created 4 years, 3 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
« no previous file with comments | « ash/common/system/tray/hover_highlight_view.cc ('k') | ash/common/system/tray/system_tray.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/tray/system_tray.h
diff --git a/ash/common/system/tray/system_tray.h b/ash/common/system/tray/system_tray.h
index 6d08cebec4d38cdbad35fa905e98a9b83593320d..5af32ff7f2c932c875db8b4dece5f1456932b335 100644
--- a/ash/common/system/tray/system_tray.h
+++ b/ash/common/system/tray/system_tray.h
@@ -19,6 +19,7 @@
namespace ash {
+class KeyEventWatcher;
enum class LoginStatus;
class ScreenTrayItem;
class SystemBubbleWrapper;
@@ -49,7 +50,7 @@ class ASH_EXPORT SystemTray : public TrayBackgroundView,
void InitializeTrayItems(SystemTrayDelegate* delegate,
WebNotificationTray* web_notification_tray);
- // Resets internal pointers.
+ // Resets internal pointers. This has to be called before deletion.
void Shutdown();
// Adds a new item in the tray. Takes ownership.
@@ -167,7 +168,22 @@ class ASH_EXPORT SystemTray : public TrayBackgroundView,
TrayDate* GetTrayDateForTesting() const;
TrayUpdate* GetTrayUpdateForTesting() const;
+ // Activates the system tray bubble.
+ void ActivateBubble();
+
private:
+ class ActivationObserver;
+
+ // Closes the bubble. Used to bind as a KeyEventWatcher::KeyEventCallback.
+ void CloseBubble(const ui::KeyEvent& key_event);
+
+ // Activates the bubble and starts key navigation with the |key_event|.
+ void ActivateAndStartNavigation(const ui::KeyEvent& key_event);
+
+ // Creates the key event watcher. See |ShowItems()| for why key events are
+ // observed.
+ void CreateKeyEventWatcher();
+
// Creates the default set of items for the sytem tray.
void CreateItems(SystemTrayDelegate* delegate);
@@ -192,10 +208,14 @@ class ASH_EXPORT SystemTray : public TrayBackgroundView,
// Constructs or re-constructs |system_bubble_| and populates it with |items|.
// Specify |change_tray_status| to true if want to change the tray background
- // status.
+ // status. The bubble will be opened in inactive state. If |can_activate| is
+ // true, the bubble will be activated by one of following means.
+ // * When alt/alt-tab acclerator is used to start navigation.
+ // * When the bubble is opened by accelerator.
+ // * When the tray item is set to be focused.
void ShowItems(const std::vector<SystemTrayItem*>& items,
bool details,
- bool activate,
+ bool can_activate,
BubbleCreationType creation_type,
int x_offset,
bool persistent);
@@ -263,6 +283,10 @@ class ASH_EXPORT SystemTray : public TrayBackgroundView,
ScreenTrayItem* screen_capture_tray_item_; // not owned
ScreenTrayItem* screen_share_tray_item_; // not owned
+ std::unique_ptr<KeyEventWatcher> key_event_watcher_;
+
+ std::unique_ptr<ActivationObserver> activation_observer_;
+
DISALLOW_COPY_AND_ASSIGN(SystemTray);
};
« no previous file with comments | « ash/common/system/tray/hover_highlight_view.cc ('k') | ash/common/system/tray/system_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698