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

Side by Side Diff: ash/wm/workspace/frame_maximize_button.cc

Issue 11280290: events: Change gesture-event handler in EventHandler to not return any values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/workspace/frame_maximize_button.h ('k') | ash/wm/workspace/workspace_event_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ash/wm/workspace/frame_maximize_button.h" 5 #include "ash/wm/workspace/frame_maximize_button.h"
6 6
7 #include "ash/launcher/launcher.h" 7 #include "ash/launcher/launcher.h"
8 #include "ash/screen_ash.h" 8 #include "ash/screen_ash.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/wm/maximize_bubble_controller.h" 10 #include "ash/wm/maximize_bubble_controller.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 if (!ProcessEndEvent(event) && snap_was_enabled) 238 if (!ProcessEndEvent(event) && snap_was_enabled)
239 ImageButton::OnMouseReleased(event); 239 ImageButton::OnMouseReleased(event);
240 // At this point |this| might be already destroyed. 240 // At this point |this| might be already destroyed.
241 } 241 }
242 242
243 void FrameMaximizeButton::OnMouseCaptureLost() { 243 void FrameMaximizeButton::OnMouseCaptureLost() {
244 Cancel(false); 244 Cancel(false);
245 ImageButton::OnMouseCaptureLost(); 245 ImageButton::OnMouseCaptureLost();
246 } 246 }
247 247
248 ui::EventResult FrameMaximizeButton::OnGestureEvent(ui::GestureEvent* event) { 248 void FrameMaximizeButton::OnGestureEvent(ui::GestureEvent* event) {
249 if (event->type() == ui::ET_GESTURE_TAP_DOWN) { 249 if (event->type() == ui::ET_GESTURE_TAP_DOWN) {
250 is_snap_enabled_ = true; 250 is_snap_enabled_ = true;
251 ProcessStartEvent(*event); 251 ProcessStartEvent(*event);
252 return ui::ER_CONSUMED; 252 event->SetHandled();
253 return;
253 } 254 }
254 255
255 if (event->type() == ui::ET_GESTURE_TAP || 256 if (event->type() == ui::ET_GESTURE_TAP ||
256 event->type() == ui::ET_GESTURE_SCROLL_END) { 257 event->type() == ui::ET_GESTURE_SCROLL_END) {
257 // The position of the event may have changed from the previous event (both 258 // The position of the event may have changed from the previous event (both
258 // for TAP and SCROLL_END). So it is necessary to update the snap-state for 259 // for TAP and SCROLL_END). So it is necessary to update the snap-state for
259 // the current event. 260 // the current event.
260 ProcessUpdateEvent(*event); 261 ProcessUpdateEvent(*event);
261 if (event->type() == ui::ET_GESTURE_TAP) 262 if (event->type() == ui::ET_GESTURE_TAP)
262 snap_type_ = SnapTypeForLocation(event->location()); 263 snap_type_ = SnapTypeForLocation(event->location());
263 ProcessEndEvent(*event); 264 ProcessEndEvent(*event);
264 return ui::ER_CONSUMED; 265 event->SetHandled();
266 return;
265 } 267 }
266 268
267 if (is_snap_enabled_) { 269 if (is_snap_enabled_) {
268 if (event->type() == ui::ET_GESTURE_END && 270 if (event->type() == ui::ET_GESTURE_END &&
269 event->details().touch_points() == 1) { 271 event->details().touch_points() == 1) {
270 // The position of the event may have changed from the previous event. So 272 // The position of the event may have changed from the previous event. So
271 // it is necessary to update the snap-state for the current event. 273 // it is necessary to update the snap-state for the current event.
272 ProcessUpdateEvent(*event); 274 ProcessUpdateEvent(*event);
273 snap_type_ = SnapTypeForLocation(event->location()); 275 snap_type_ = SnapTypeForLocation(event->location());
274 ProcessEndEvent(*event); 276 ProcessEndEvent(*event);
275 return ui::ER_CONSUMED; 277 event->SetHandled();
278 return;
276 } 279 }
277 280
278 if (event->type() == ui::ET_GESTURE_SCROLL_UPDATE || 281 if (event->type() == ui::ET_GESTURE_SCROLL_UPDATE ||
279 event->type() == ui::ET_GESTURE_SCROLL_BEGIN) { 282 event->type() == ui::ET_GESTURE_SCROLL_BEGIN) {
280 ProcessUpdateEvent(*event); 283 ProcessUpdateEvent(*event);
281 return ui::ER_CONSUMED; 284 event->SetHandled();
285 return;
282 } 286 }
283 } 287 }
284 288
285 return ImageButton::OnGestureEvent(event); 289 ImageButton::OnGestureEvent(event);
286 } 290 }
287 291
288 void FrameMaximizeButton::ProcessStartEvent(const ui::LocatedEvent& event) { 292 void FrameMaximizeButton::ProcessStartEvent(const ui::LocatedEvent& event) {
289 DCHECK(is_snap_enabled_); 293 DCHECK(is_snap_enabled_);
290 // Prepare the help menu. 294 // Prepare the help menu.
291 if (!maximizer_.get()) { 295 if (!maximizer_.get()) {
292 maximizer_.reset(new MaximizeBubbleController( 296 maximizer_.reset(new MaximizeBubbleController(
293 this, 297 this,
294 GetMaximizeBubbleFrameState(), 298 GetMaximizeBubbleFrameState(),
295 bubble_appearance_delay_ms_)); 299 bubble_appearance_delay_ms_));
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 return FRAME_STATE_SNAP_LEFT; 558 return FRAME_STATE_SNAP_LEFT;
555 if (bounds.right() == screen.right()) 559 if (bounds.right() == screen.right())
556 return FRAME_STATE_SNAP_RIGHT; 560 return FRAME_STATE_SNAP_RIGHT;
557 // If we come here, it is likely caused by the fact that the 561 // If we come here, it is likely caused by the fact that the
558 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case 562 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case
559 // we allow all maximize operations (and keep the restore rectangle). 563 // we allow all maximize operations (and keep the restore rectangle).
560 return FRAME_STATE_NONE; 564 return FRAME_STATE_NONE;
561 } 565 }
562 566
563 } // namespace ash 567 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/frame_maximize_button.h ('k') | ash/wm/workspace/workspace_event_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698