OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/message_center/message_view.h" | 5 #include "ui/message_center/message_view.h" |
6 | 6 |
7 #include "grit/ui_resources.h" | 7 #include "grit/ui_resources.h" |
8 #include "grit/ui_strings.h" | 8 #include "grit/ui_strings.h" |
9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
10 #include "ui/base/models/simple_menu_model.h" | 10 #include "ui/base/models/simple_menu_model.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 bool MessageView::OnMousePressed(const ui::MouseEvent& event) { | 128 bool MessageView::OnMousePressed(const ui::MouseEvent& event) { |
129 if (event.flags() & ui::EF_RIGHT_MOUSE_BUTTON) { | 129 if (event.flags() & ui::EF_RIGHT_MOUSE_BUTTON) { |
130 ShowMenu(event.location()); | 130 ShowMenu(event.location()); |
131 return true; | 131 return true; |
132 } | 132 } |
133 list_delegate_->OnNotificationClicked(notification_.id); | 133 list_delegate_->OnNotificationClicked(notification_.id); |
134 return true; | 134 return true; |
135 } | 135 } |
136 | 136 |
137 ui::EventResult MessageView::OnGestureEvent(ui::GestureEvent* event) { | 137 void MessageView::OnGestureEvent(ui::GestureEvent* event) { |
138 if (event->type() == ui::ET_GESTURE_TAP) { | 138 if (event->type() == ui::ET_GESTURE_TAP) { |
139 list_delegate_->OnNotificationClicked(notification_.id); | 139 list_delegate_->OnNotificationClicked(notification_.id); |
140 return ui::ER_CONSUMED; | 140 event->SetHandled(); |
| 141 return; |
141 } | 142 } |
142 | 143 |
143 if (event->type() == ui::ET_GESTURE_LONG_PRESS) { | 144 if (event->type() == ui::ET_GESTURE_LONG_PRESS) { |
144 ShowMenu(event->location()); | 145 ShowMenu(event->location()); |
145 return ui::ER_CONSUMED; | 146 event->SetHandled(); |
| 147 return; |
146 } | 148 } |
147 | 149 |
148 ui::EventResult result = SlideOutView::OnGestureEvent(event); | 150 SlideOutView::OnGestureEvent(event); |
149 if (result & ui::ER_CONSUMED) | 151 if (event->handled()) |
150 return result; | 152 return; |
151 | 153 |
152 if (!event->IsScrollGestureEvent()) | 154 if (!event->IsScrollGestureEvent()) |
153 return result; | 155 return; |
154 | 156 |
155 if (scroller_) | 157 if (scroller_) |
156 scroller_->OnGestureEvent(event); | 158 scroller_->OnGestureEvent(event); |
157 | 159 event->SetHandled(); |
158 return ui::ER_CONSUMED; | |
159 } | 160 } |
160 | 161 |
161 void MessageView::ButtonPressed(views::Button* sender, | 162 void MessageView::ButtonPressed(views::Button* sender, |
162 const ui::Event& event) { | 163 const ui::Event& event) { |
163 if (sender == close_button_) | 164 if (sender == close_button_) |
164 list_delegate_->SendRemoveNotification(notification_.id); | 165 list_delegate_->SendRemoveNotification(notification_.id); |
165 } | 166 } |
166 | 167 |
167 void MessageView::ShowMenu(gfx::Point screen_location) { | 168 void MessageView::ShowMenu(gfx::Point screen_location) { |
168 WebNotificationMenuModel menu_model(list_delegate_, notification_); | 169 WebNotificationMenuModel menu_model(list_delegate_, notification_); |
(...skipping 10 matching lines...) Expand all Loading... |
179 gfx::Rect(screen_location, gfx::Size()), | 180 gfx::Rect(screen_location, gfx::Size()), |
180 views::MenuItemView::TOPRIGHT, | 181 views::MenuItemView::TOPRIGHT, |
181 views::MenuRunner::HAS_MNEMONICS)); | 182 views::MenuRunner::HAS_MNEMONICS)); |
182 } | 183 } |
183 | 184 |
184 void MessageView::OnSlideOut() { | 185 void MessageView::OnSlideOut() { |
185 list_delegate_->SendRemoveNotification(notification_.id); | 186 list_delegate_->SendRemoveNotification(notification_.id); |
186 } | 187 } |
187 | 188 |
188 } // namespace message_center | 189 } // namespace message_center |
OLD | NEW |