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

Side by Side Diff: views/widget/root_view.cc

Issue 6347002: touch: Return an enum from OnTouchEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "views/widget/root_view.h" 5 #include "views/widget/root_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "app/drag_drop_types.h" 9 #include "app/drag_drop_types.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 } 280 }
281 281
282 if (child == drag_view_) 282 if (child == drag_view_)
283 drag_view_ = NULL; 283 drag_view_ = NULL;
284 284
285 if (default_keyboard_handler_ == child) { 285 if (default_keyboard_handler_ == child) {
286 default_keyboard_handler_ = NULL; 286 default_keyboard_handler_ = NULL;
287 } 287 }
288 288
289 #if defined(TOUCH_UI) 289 #if defined(TOUCH_UI)
290 if (touch_pressed_handler_) { 290 if (touch_pressed_handler_ == child) {
291 touch_pressed_handler_ = NULL; 291 touch_pressed_handler_ = NULL;
292 } 292 }
293 #endif 293 #endif
294 294
295 FocusManager* focus_manager = widget_->GetFocusManager(); 295 FocusManager* focus_manager = widget_->GetFocusManager();
296 // An unparanted RootView does not have a FocusManager. 296 // An unparanted RootView does not have a FocusManager.
297 if (focus_manager) 297 if (focus_manager)
298 focus_manager->ViewRemoved(parent, child); 298 focus_manager->ViewRemoved(parent, child);
299 299
300 ViewStorage::GetInstance()->ViewRemoved(parent, child); 300 ViewStorage::GetInstance()->ViewRemoved(parent, child);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 // 340 //
341 // NOTE: Don't return true here, because we don't want the frame to 341 // NOTE: Don't return true here, because we don't want the frame to
342 // forward future events to us when there's no handler. 342 // forward future events to us when there's no handler.
343 if (!touch_pressed_handler_) 343 if (!touch_pressed_handler_)
344 break; 344 break;
345 345
346 // If the view handled the event, leave touch_pressed_handler_ set and 346 // If the view handled the event, leave touch_pressed_handler_ set and
347 // return true, which will cause subsequent drag/release events to get 347 // return true, which will cause subsequent drag/release events to get
348 // forwarded to that view. 348 // forwarded to that view.
349 if (handled) { 349 if (handled) {
350 touch_pressed_handler_->set_touch_event_observer(this);
350 gesture_manager_->ProcessTouchEventForGesture(e, this, handled); 351 gesture_manager_->ProcessTouchEventForGesture(e, this, handled);
351 return true; 352 return true;
352 } 353 }
353 } 354 }
354 355
355 // Reset touch_pressed_handler_ to indicate that no processing is occurring. 356 // Reset touch_pressed_handler_ to indicate that no processing is occurring.
356 touch_pressed_handler_ = NULL; 357 touch_pressed_handler_ = NULL;
357 358
358 // Give the touch event to the gesture manager. 359 // Give the touch event to the gesture manager.
359 gesture_manager_->ProcessTouchEventForGesture(e, this, handled); 360 gesture_manager_->ProcessTouchEventForGesture(e, this, handled);
360 return handled; 361 return handled;
361 } 362 }
362 #endif 363
364 void RootView::OnTouchSequenceEnd() {
365 DCHECK(touch_pressed_handler_);
366 touch_pressed_handler_ = NULL;
367 }
368
369 #endif // defined(TOUCH_UI)
363 370
364 bool RootView::OnMousePressed(const MouseEvent& e) { 371 bool RootView::OnMousePressed(const MouseEvent& e) {
365 // This function does not normally handle non-client messages except for 372 // This function does not normally handle non-client messages except for
366 // non-client double-clicks. Actually, all double-clicks are special as the 373 // non-client double-clicks. Actually, all double-clicks are special as the
367 // are formed from a single-click followed by a double-click event. When the 374 // are formed from a single-click followed by a double-click event. When the
368 // double-click event lands on a different view than its single-click part, 375 // double-click event lands on a different view than its single-click part,
369 // we transform it into a single-click which prevents odd things. 376 // we transform it into a single-click which prevents odd things.
370 if ((e.GetFlags() & MouseEvent::EF_IS_NON_CLIENT) && 377 if ((e.GetFlags() & MouseEvent::EF_IS_NON_CLIENT) &&
371 !(e.GetFlags() & MouseEvent::EF_IS_DOUBLE_CLICK)) { 378 !(e.GetFlags() & MouseEvent::EF_IS_DOUBLE_CLICK)) {
372 last_click_handler_ = NULL; 379 last_click_handler_ = NULL;
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 #elif defined(OS_LINUX) 792 #elif defined(OS_LINUX)
786 gfx::NativeView native_view = 793 gfx::NativeView native_view =
787 static_cast<WidgetGtk*>(GetWidget())->window_contents(); 794 static_cast<WidgetGtk*>(GetWidget())->window_contents();
788 if (!native_view) 795 if (!native_view)
789 return; 796 return;
790 gdk_window_set_cursor(native_view->window, cursor); 797 gdk_window_set_cursor(native_view->window, cursor);
791 #endif 798 #endif
792 } 799 }
793 800
794 } // namespace views 801 } // namespace views
OLDNEW
« chrome/browser/renderer_host/render_widget_host_view_views.cc ('K') | « views/widget/root_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698