summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authormukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-02 00:29:15 +0000
committermukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-02 00:29:15 +0000
commit7271d235b17a871a5e846ea02548eca8bbecd541 (patch)
tree744b570ee219b56b115cdcd80788e5c5ddb76631 /ui
parent2e2a195415a0cbe4a7678f04d4152a7c57e2d0ce (diff)
downloadchromium_src-7271d235b17a871a5e846ea02548eca8bbecd541.zip
chromium_src-7271d235b17a871a5e846ea02548eca8bbecd541.tar.gz
chromium_src-7271d235b17a871a5e846ea02548eca8bbecd541.tar.bz2
Handles the mouse wheel event in the message center.
Specifies the focus to the scroller, otherwise the mouse wheel events are ignored. At the same time, the mouse wheel event should be handled in MessageCenterView and passed to scroller_ in case the focus goes outside of the scroller (like 'close all' buttons). BUG=222777 Review URL: https://chromiumcodereview.appspot.com/13190017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191722 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/message_center/views/message_center_bubble.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/ui/message_center/views/message_center_bubble.cc b/ui/message_center/views/message_center_bubble.cc
index 32e95bf..1c1a718 100644
--- a/ui/message_center/views/message_center_bubble.cc
+++ b/ui/message_center/views/message_center_bubble.cc
@@ -291,6 +291,8 @@ BoundedScrollView::BoundedScrollView(int min_height, int max_height)
: min_height_(min_height),
max_height_(max_height) {
set_notify_enter_exit_on_child(true);
+ // Cancels the default dashed focus border.
+ set_focus_border(NULL);
if (IsRichNotificationEnabled()) {
set_background(views::Background::CreateSolidBackground(
kMessageCenterBackgroundColor));
@@ -394,6 +396,7 @@ class MessageCenterView : public views::View {
protected:
// Overridden from views::View:
virtual void Layout() OVERRIDE;
+ virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE;
private:
void RemoveAllNotifications();
@@ -469,6 +472,7 @@ void MessageCenterView::UpdateAllNotifications(
} else {
button_view_->SetCloseAllVisible(true);
scroller_->set_focusable(true);
+ scroller_->RequestFocus();
}
Layout();
}
@@ -485,6 +489,16 @@ void MessageCenterView::Layout() {
bubble_->bubble_view()->UpdateBubble();
}
+bool MessageCenterView::OnMouseWheel(const ui::MouseWheelEvent& event) {
+ // Do not rely on the default scroll event handler of ScrollView because
+ // the scroll happens only when the focus is on the ScrollView. The
+ // notification center will allow the scrolling even when the focus is on
+ // the buttons.
+ if (scroller_->bounds().Contains(event.location()))
+ return scroller_->OnMouseWheel(event);
+ return views::View::OnMouseWheel(event);
+}
+
void MessageCenterView::RemoveAllNotifications() {
message_views_.clear();
message_list_view_->RemoveAllChildViews(true);