diff options
author | vasilii@chromium.org <vasilii@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-25 21:21:48 +0000 |
---|---|---|
committer | vasilii@chromium.org <vasilii@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-25 21:21:48 +0000 |
commit | 2fe3a1258097951bc015142effb37c38cdc65567 (patch) | |
tree | a2676bd36cb8fd5c5cc1db39947262762f52d09e /ui/views/bubble | |
parent | 401c9dc414cd708d53ced5d884f8eb3a8b4bcbe5 (diff) | |
download | chromium_src-2fe3a1258097951bc015142effb37c38cdc65567.zip chromium_src-2fe3a1258097951bc015142effb37c38cdc65567.tar.gz chromium_src-2fe3a1258097951bc015142effb37c38cdc65567.tar.bz2 |
Refactor BubbleDelegateView::use_focuseless().
It's confusing because it prevents the bubble activation. As a side effect on Windows the bubble doesn't get LBUTTON_DOWN messages. The reason for that is in HWNDMessageHandler::OnMouseActivate(). It asks the bubble if it can be activated. It answers "no" due to implementation in BubbleDelegateView::CanActivate(). Windows gets MA_NOACTIVATEANDEAT and MouseDown event isn't dispatched. This is definitely unexpected.
The bubbles which indeed always inactive should use set_can_activate(false) at construction time.
The bubbles which can be active but created without focus by default should use ShowInactive() instead.
BUG=392734
Review URL: https://codereview.chromium.org/413433002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285682 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/bubble')
-rw-r--r-- | ui/views/bubble/bubble_delegate.cc | 6 | ||||
-rw-r--r-- | ui/views/bubble/bubble_delegate.h | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/ui/views/bubble/bubble_delegate.cc b/ui/views/bubble/bubble_delegate.cc index 0eab071..b52f95b 100644 --- a/ui/views/bubble/bubble_delegate.cc +++ b/ui/views/bubble/bubble_delegate.cc @@ -54,7 +54,7 @@ BubbleDelegateView::BubbleDelegateView() shadow_(BubbleBorder::SMALL_SHADOW), color_explicitly_set_(false), margins_(kDefaultMargin, kDefaultMargin, kDefaultMargin, kDefaultMargin), - use_focusless_(false), + can_activate_(true), accept_events_(true), border_accepts_events_(true), adjust_if_offscreen_(true), @@ -74,7 +74,7 @@ BubbleDelegateView::BubbleDelegateView( shadow_(BubbleBorder::SMALL_SHADOW), color_explicitly_set_(false), margins_(kDefaultMargin, kDefaultMargin, kDefaultMargin, kDefaultMargin), - use_focusless_(false), + can_activate_(true), accept_events_(true), border_accepts_events_(true), adjust_if_offscreen_(true), @@ -118,7 +118,7 @@ BubbleDelegateView* BubbleDelegateView::AsBubbleDelegate() { } bool BubbleDelegateView::CanActivate() const { - return !use_focusless(); + return can_activate(); } bool BubbleDelegateView::ShouldShowCloseButton() const { diff --git a/ui/views/bubble/bubble_delegate.h b/ui/views/bubble/bubble_delegate.h index e61111b..98b4ea2 100644 --- a/ui/views/bubble/bubble_delegate.h +++ b/ui/views/bubble/bubble_delegate.h @@ -83,8 +83,8 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, gfx::NativeView parent_window() const { return parent_window_; } void set_parent_window(gfx::NativeView window) { parent_window_ = window; } - bool use_focusless() const { return use_focusless_; } - void set_use_focusless(bool focusless) { use_focusless_ = focusless; } + bool can_activate() const { return can_activate_; } + void set_can_activate(bool focusless) { can_activate_ = focusless; } bool accept_events() const { return accept_events_; } void set_accept_events(bool accept_events) { accept_events_ = accept_events; } @@ -183,8 +183,8 @@ class VIEWS_EXPORT BubbleDelegateView : public WidgetDelegateView, // Insets applied to the |anchor_view_| bounds. gfx::Insets anchor_view_insets_; - // If true, the bubble does not take focus on display; default is false. - bool use_focusless_; + // If false, the bubble can't be activated; default is true. + bool can_activate_; // Specifies whether the bubble (or its border) handles mouse events, etc. bool accept_events_; |