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

Side by Side Diff: chrome/browser/ui/views/tabs/tab_drag_controller.cc

Issue 1907323003: Drag and drop cleans up touch sequences from the source window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update GR state without actually dispatching press events. Created 4 years, 7 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) 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 "chrome/browser/ui/views/tabs/tab_drag_controller.h" 5 #include "chrome/browser/ui/views/tabs/tab_drag_controller.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <set> 8 #include <set>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 TRACE_EVENT1("views", "TabDragController::DragBrowserToNewTabStrip", 571 TRACE_EVENT1("views", "TabDragController::DragBrowserToNewTabStrip",
572 "point_in_screen", point_in_screen.ToString()); 572 "point_in_screen", point_in_screen.ToString());
573 573
574 if (!target_tabstrip) { 574 if (!target_tabstrip) {
575 DetachIntoNewBrowserAndRunMoveLoop(point_in_screen); 575 DetachIntoNewBrowserAndRunMoveLoop(point_in_screen);
576 return DRAG_BROWSER_RESULT_STOP; 576 return DRAG_BROWSER_RESULT_STOP;
577 } 577 }
578 578
579 #if defined(USE_AURA) 579 #if defined(USE_AURA)
580 // Only Aura windows are gesture consumers. 580 // Only Aura windows are gesture consumers.
581 ui::GestureRecognizer::Get()->TransferEventsTo( 581 ui::GestureRecognizer::Get()->BeginTabDrag(
582 GetAttachedBrowserWidget()->GetNativeView(), 582 GetAttachedBrowserWidget()->GetNativeView(),
583 target_tabstrip->GetWidget()->GetNativeView()); 583 target_tabstrip->GetWidget()->GetNativeView());
584 #endif 584 #endif
585 585
586 if (is_dragging_window_) { 586 if (is_dragging_window_) {
587 // ReleaseCapture() is going to result in calling back to us (because it 587 // ReleaseCapture() is going to result in calling back to us (because it
588 // results in a move). That'll cause all sorts of problems. Reset the 588 // results in a move). That'll cause all sorts of problems. Reset the
589 // observer so we don't get notified and process the event. 589 // observer so we don't get notified and process the event.
590 #if defined(USE_ASH) 590 #if defined(USE_ASH)
591 move_loop_widget_->RemoveObserver(this); 591 move_loop_widget_->RemoveObserver(this);
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 attached_tabstrip_, point_in_screen, &drag_offset, &drag_bounds); 1027 attached_tabstrip_, point_in_screen, &drag_offset, &drag_bounds);
1028 1028
1029 BrowserView* dragged_browser_view = 1029 BrowserView* dragged_browser_view =
1030 BrowserView::GetBrowserViewForBrowser(browser); 1030 BrowserView::GetBrowserViewForBrowser(browser);
1031 views::Widget* dragged_widget = dragged_browser_view->GetWidget(); 1031 views::Widget* dragged_widget = dragged_browser_view->GetWidget();
1032 1032
1033 #if defined(USE_AURA) 1033 #if defined(USE_AURA)
1034 // Only Aura windows are gesture consumers. 1034 // Only Aura windows are gesture consumers.
1035 gfx::NativeView attached_native_view = 1035 gfx::NativeView attached_native_view =
1036 attached_tabstrip_->GetWidget()->GetNativeView(); 1036 attached_tabstrip_->GetWidget()->GetNativeView();
1037 ui::GestureRecognizer::Get()->TransferEventsTo( 1037 ui::GestureRecognizer::Get()->BeginTabDrag(attached_native_view,
1038 attached_native_view, dragged_widget->GetNativeView()); 1038 dragged_widget->GetNativeView());
1039 #endif 1039 #endif
1040 1040
1041 Detach(can_release_capture_ ? RELEASE_CAPTURE : DONT_RELEASE_CAPTURE); 1041 Detach(can_release_capture_ ? RELEASE_CAPTURE : DONT_RELEASE_CAPTURE);
1042 1042
1043 dragged_widget->SetVisibilityChangedAnimationsEnabled(false); 1043 dragged_widget->SetVisibilityChangedAnimationsEnabled(false);
1044 Attach(dragged_browser_view->tabstrip(), gfx::Point()); 1044 Attach(dragged_browser_view->tabstrip(), gfx::Point());
1045 AdjustBrowserAndTabBoundsForDrag(last_tabstrip_width, 1045 AdjustBrowserAndTabBoundsForDrag(last_tabstrip_width,
1046 point_in_screen, 1046 point_in_screen,
1047 &drag_bounds); 1047 &drag_bounds);
1048 WindowPositionManagedUpdater updater; 1048 WindowPositionManagedUpdater updater;
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 // TODO(pkotwicz): Fix this properly (crbug.com/358482) 1804 // TODO(pkotwicz): Fix this properly (crbug.com/358482)
1805 for (auto* browser : *BrowserList::GetInstance()) { 1805 for (auto* browser : *BrowserList::GetInstance()) {
1806 if (browser->tab_strip_model()->empty()) 1806 if (browser->tab_strip_model()->empty())
1807 exclude.insert(browser->window()->GetNativeWindow()); 1807 exclude.insert(browser->window()->GetNativeWindow());
1808 } 1808 }
1809 #endif 1809 #endif
1810 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); 1810 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr());
1811 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); 1811 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude);
1812 return ref ? Liveness::ALIVE : Liveness::DELETED; 1812 return ref ? Liveness::ALIVE : Liveness::DELETED;
1813 } 1813 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698