| 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 "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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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()->TransferEventsTo( |
| 582 GetAttachedBrowserWidget()->GetNativeView(), | 582 GetAttachedBrowserWidget()->GetNativeView(), |
| 583 target_tabstrip->GetWidget()->GetNativeView()); | 583 target_tabstrip->GetWidget()->GetNativeView(), |
| 584 ui::GestureRecognizer::ShouldCancelTouches::DontCancel); |
| 584 #endif | 585 #endif |
| 585 | 586 |
| 586 if (is_dragging_window_) { | 587 if (is_dragging_window_) { |
| 587 // ReleaseCapture() is going to result in calling back to us (because it | 588 // 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 | 589 // 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. | 590 // observer so we don't get notified and process the event. |
| 590 #if defined(USE_ASH) | 591 #if defined(USE_ASH) |
| 591 move_loop_widget_->RemoveObserver(this); | 592 move_loop_widget_->RemoveObserver(this); |
| 592 move_loop_widget_ = nullptr; | 593 move_loop_widget_ = nullptr; |
| 593 #endif // USE_ASH | 594 #endif // USE_ASH |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1028 | 1029 |
| 1029 BrowserView* dragged_browser_view = | 1030 BrowserView* dragged_browser_view = |
| 1030 BrowserView::GetBrowserViewForBrowser(browser); | 1031 BrowserView::GetBrowserViewForBrowser(browser); |
| 1031 views::Widget* dragged_widget = dragged_browser_view->GetWidget(); | 1032 views::Widget* dragged_widget = dragged_browser_view->GetWidget(); |
| 1032 | 1033 |
| 1033 #if defined(USE_AURA) | 1034 #if defined(USE_AURA) |
| 1034 // Only Aura windows are gesture consumers. | 1035 // Only Aura windows are gesture consumers. |
| 1035 gfx::NativeView attached_native_view = | 1036 gfx::NativeView attached_native_view = |
| 1036 attached_tabstrip_->GetWidget()->GetNativeView(); | 1037 attached_tabstrip_->GetWidget()->GetNativeView(); |
| 1037 ui::GestureRecognizer::Get()->TransferEventsTo( | 1038 ui::GestureRecognizer::Get()->TransferEventsTo( |
| 1038 attached_native_view, dragged_widget->GetNativeView()); | 1039 attached_native_view, dragged_widget->GetNativeView(), |
| 1040 ui::GestureRecognizer::ShouldCancelTouches::DontCancel); |
| 1039 #endif | 1041 #endif |
| 1040 | 1042 |
| 1041 Detach(can_release_capture_ ? RELEASE_CAPTURE : DONT_RELEASE_CAPTURE); | 1043 Detach(can_release_capture_ ? RELEASE_CAPTURE : DONT_RELEASE_CAPTURE); |
| 1042 | 1044 |
| 1043 dragged_widget->SetVisibilityChangedAnimationsEnabled(false); | 1045 dragged_widget->SetVisibilityChangedAnimationsEnabled(false); |
| 1044 Attach(dragged_browser_view->tabstrip(), gfx::Point()); | 1046 Attach(dragged_browser_view->tabstrip(), gfx::Point()); |
| 1045 AdjustBrowserAndTabBoundsForDrag(last_tabstrip_width, | 1047 AdjustBrowserAndTabBoundsForDrag(last_tabstrip_width, |
| 1046 point_in_screen, | 1048 point_in_screen, |
| 1047 &drag_bounds); | 1049 &drag_bounds); |
| 1048 WindowPositionManagedUpdater updater; | 1050 WindowPositionManagedUpdater updater; |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1804 // TODO(pkotwicz): Fix this properly (crbug.com/358482) | 1806 // TODO(pkotwicz): Fix this properly (crbug.com/358482) |
| 1805 for (auto* browser : *BrowserList::GetInstance()) { | 1807 for (auto* browser : *BrowserList::GetInstance()) { |
| 1806 if (browser->tab_strip_model()->empty()) | 1808 if (browser->tab_strip_model()->empty()) |
| 1807 exclude.insert(browser->window()->GetNativeWindow()); | 1809 exclude.insert(browser->window()->GetNativeWindow()); |
| 1808 } | 1810 } |
| 1809 #endif | 1811 #endif |
| 1810 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); | 1812 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); |
| 1811 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); | 1813 *window = window_finder_->GetLocalProcessWindowAtPoint(screen_point, exclude); |
| 1812 return ref ? Liveness::ALIVE : Liveness::DELETED; | 1814 return ref ? Liveness::ALIVE : Liveness::DELETED; |
| 1813 } | 1815 } |
| OLD | NEW |