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

Side by Side Diff: ui/views/touchui/touch_selection_controller_impl.cc

Issue 651323002: Fixing a "use after free". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding a unit test for WindowEventDispatcher Created 6 years, 2 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/views/touchui/touch_selection_controller_impl.h" 5 #include "ui/views/touchui/touch_selection_controller_impl.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "ui/aura/client/cursor_client.h" 8 #include "ui/aura/client/cursor_client.h"
9 #include "ui/aura/env.h" 9 #include "ui/aura/env.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 kSelectionHandleVerticalDragOffset; 215 kSelectionHandleVerticalDragOffset;
216 break; 216 break;
217 case ui::ET_GESTURE_SCROLL_UPDATE: { 217 case ui::ET_GESTURE_SCROLL_UPDATE: {
218 gfx::Point drag_pos(event->location().x(), 218 gfx::Point drag_pos(event->location().x(),
219 event->location().y() - drag_offset_); 219 event->location().y() - drag_offset_);
220 controller_->SelectionHandleDragged(drag_pos); 220 controller_->SelectionHandleDragged(drag_pos);
221 break; 221 break;
222 } 222 }
223 case ui::ET_GESTURE_SCROLL_END: 223 case ui::ET_GESTURE_SCROLL_END:
224 case ui::ET_SCROLL_FLING_START: 224 case ui::ET_SCROLL_FLING_START:
225 controller_->SetDraggingHandle(NULL);
226 // ReleaseCapture() is potentially destructive and should be done at
227 // the very end.
225 widget_->ReleaseCapture(); 228 widget_->ReleaseCapture();
226 controller_->SetDraggingHandle(NULL);
227 break; 229 break;
228 default: 230 default:
229 break; 231 break;
230 } 232 }
231 } 233 }
232 234
233 virtual gfx::Size GetPreferredSize() const override { 235 virtual gfx::Size GetPreferredSize() const override {
234 gfx::Size image_size = GetHandleImageSize(); 236 gfx::Size image_size = GetHandleImageSize();
235 return gfx::Size(image_size.width() + 2 * kSelectionHandleHorizPadding, 237 return gfx::Size(image_size.width() + 2 * kSelectionHandleHorizPadding,
236 image_size.height() + selection_rect_.height() + 238 image_size.height() + selection_rect_.height() +
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 627
626 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() { 628 bool TouchSelectionControllerImpl::IsSelectionHandle2Visible() {
627 return selection_handle_2_->IsWidgetVisible(); 629 return selection_handle_2_->IsWidgetVisible();
628 } 630 }
629 631
630 bool TouchSelectionControllerImpl::IsCursorHandleVisible() { 632 bool TouchSelectionControllerImpl::IsCursorHandleVisible() {
631 return cursor_handle_->IsWidgetVisible(); 633 return cursor_handle_->IsWidgetVisible();
632 } 634 }
633 635
634 } // namespace views 636 } // namespace views
OLDNEW
« ui/aura/window_event_dispatcher.cc ('K') | « ui/aura/window_event_dispatcher_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698