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

Unified Diff: ui/views/bubble/tray_bubble_view.h

Issue 2897553002: Do not activate TrayBubbleView by default (Closed)
Patch Set: Add comment. Created 3 years, 6 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: ui/views/bubble/tray_bubble_view.h
diff --git a/ui/views/bubble/tray_bubble_view.h b/ui/views/bubble/tray_bubble_view.h
index 81042a839e1dc55c79d2e3b6af1f2fc76cb62a4b..da0b1317a0a520312ddb7d7f08faa32f92ec1a9b 100644
--- a/ui/views/bubble/tray_bubble_view.h
+++ b/ui/views/bubble/tray_bubble_view.h
@@ -9,6 +9,8 @@
#include "base/macros.h"
#include "base/optional.h"
+#include "ui/base/accelerators/accelerator.h"
+#include "ui/events/event.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/views/bubble/bubble_dialog_delegate.h"
#include "ui/views/mouse_watcher.h"
@@ -58,10 +60,27 @@ class VIEWS_EXPORT TrayBubbleView : public BubbleDialogDelegateView,
virtual void OnMouseEnteredView() = 0;
virtual void OnMouseExitedView() = 0;
+ // Called to register/unregister accelerators for TrayBubbleView.
+ // TrayBubbleView wants to register those accelerators at the global level.
+ // Those accelerators are used to activate TrayBubbleView, i.e. those
+ // accelerators need to be processed even if TrayBubbleView is not active.
+ // UnregisterAllAccelerators can be called even if RegisterAccelerators is
+ // not called.
+ virtual void RegisterAccelerators(
+ const std::vector<ui::Accelerator>& accelerators,
+ TrayBubbleView* tray_bubble_view) = 0;
+ virtual void UnregisterAllAccelerators(
+ TrayBubbleView* tray_bubble_view) = 0;
+
// Called from GetAccessibleNodeData(); should return the appropriate
// accessible name for the bubble.
virtual base::string16 GetAccessibleNameForBubble() = 0;
+ // Should return true if extra keyboard accessibility is enabled.
+ // TrayBubbleView will put focus on the default item if extra keyboard
+ // accessibility is enabled.
+ virtual bool ShouldEnableExtraKeyboardAccessibility() = 0;
+
// Called when a bubble wants to hide/destroy itself (e.g. last visible
// child view was closed).
virtual void HideBubble(const TrayBubbleView* bubble_view) = 0;
@@ -108,11 +127,16 @@ class VIEWS_EXPORT TrayBubbleView : public BubbleDialogDelegateView,
// Sets the bubble width.
void SetWidth(int width);
+ // Focus the default item if no item is focused.
+ void FocusDefaultIfNeeded();
+
// Returns the border insets. Called by TrayEventFilter.
gfx::Insets GetBorderInsets() const;
- // Called when the delegate is destroyed.
- void reset_delegate() { delegate_ = NULL; }
+ // Called when the delegate is destroyed. This must be called before the
+ // delegate is actually destroyed. TrayBubbleView will do clean up in
+ // ResetDelegate.
+ void ResetDelegate();
Delegate* delegate() { return delegate_; }
@@ -142,6 +166,9 @@ class VIEWS_EXPORT TrayBubbleView : public BubbleDialogDelegateView,
// Overridden from MouseWatcherListener
void MouseMovedOutOfHost() override;
+ // Overridden from ui::AcceleratorTarget
+ bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
+
protected:
// Overridden from views::BubbleDialogDelegateView.
int GetDialogButtons() const override;
@@ -152,6 +179,9 @@ class VIEWS_EXPORT TrayBubbleView : public BubbleDialogDelegateView,
const ViewHierarchyChangedDetails& details) override;
private:
+ void CloseBubbleView();
+ void ActivateAndStartNavigation(const ui::KeyEvent& key_event);
+
InitParams params_;
BoxLayout* layout_;
Delegate* delegate_;

Powered by Google App Engine
This is Rietveld 408576698