Chromium Code Reviews| 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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 580 TabStrip* target_tabstrip, | 580 TabStrip* target_tabstrip, |
| 581 const gfx::Point& point_in_screen) { | 581 const gfx::Point& point_in_screen) { |
| 582 TRACE_EVENT1("views", "TabDragController::DragBrowserToNewTabStrip", | 582 TRACE_EVENT1("views", "TabDragController::DragBrowserToNewTabStrip", |
| 583 "point_in_screen", point_in_screen.ToString()); | 583 "point_in_screen", point_in_screen.ToString()); |
| 584 | 584 |
| 585 if (!target_tabstrip) { | 585 if (!target_tabstrip) { |
| 586 DetachIntoNewBrowserAndRunMoveLoop(point_in_screen); | 586 DetachIntoNewBrowserAndRunMoveLoop(point_in_screen); |
| 587 return DRAG_BROWSER_RESULT_STOP; | 587 return DRAG_BROWSER_RESULT_STOP; |
| 588 } | 588 } |
| 589 | 589 |
| 590 #if defined(USE_AURA) | |
| 591 // Only Aura windows are gesture consumers. | |
| 590 ui::GestureRecognizer::Get()->TransferEventsTo( | 592 ui::GestureRecognizer::Get()->TransferEventsTo( |
| 591 GetAttachedBrowserWidget()->GetNativeView(), | 593 GetAttachedBrowserWidget()->GetNativeView(), |
| 592 target_tabstrip->GetWidget()->GetNativeView()); | 594 target_tabstrip->GetWidget()->GetNativeView()); |
| 595 #endif | |
|
tapted
2015/04/02 10:38:22
note that before r321128 these were #ifdef OS_WIN
| |
| 593 | 596 |
| 594 if (is_dragging_window_) { | 597 if (is_dragging_window_) { |
| 595 // ReleaseCapture() is going to result in calling back to us (because it | 598 // ReleaseCapture() is going to result in calling back to us (because it |
| 596 // results in a move). That'll cause all sorts of problems. Reset the | 599 // results in a move). That'll cause all sorts of problems. Reset the |
| 597 // observer so we don't get notified and process the event. | 600 // observer so we don't get notified and process the event. |
| 598 if (host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH) { | 601 if (host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH) { |
| 599 move_loop_widget_->RemoveObserver(this); | 602 move_loop_widget_->RemoveObserver(this); |
| 600 move_loop_widget_ = NULL; | 603 move_loop_widget_ = NULL; |
| 601 } | 604 } |
| 602 views::Widget* browser_widget = GetAttachedBrowserWidget(); | 605 views::Widget* browser_widget = GetAttachedBrowserWidget(); |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1019 std::vector<gfx::Rect> drag_bounds = CalculateBoundsForDraggedTabs(); | 1022 std::vector<gfx::Rect> drag_bounds = CalculateBoundsForDraggedTabs(); |
| 1020 OffsetX(GetAttachedDragPoint(point_in_screen).x(), &drag_bounds); | 1023 OffsetX(GetAttachedDragPoint(point_in_screen).x(), &drag_bounds); |
| 1021 | 1024 |
| 1022 gfx::Vector2d drag_offset; | 1025 gfx::Vector2d drag_offset; |
| 1023 Browser* browser = CreateBrowserForDrag( | 1026 Browser* browser = CreateBrowserForDrag( |
| 1024 attached_tabstrip_, point_in_screen, &drag_offset, &drag_bounds); | 1027 attached_tabstrip_, point_in_screen, &drag_offset, &drag_bounds); |
| 1025 | 1028 |
| 1026 BrowserView* dragged_browser_view = | 1029 BrowserView* dragged_browser_view = |
| 1027 BrowserView::GetBrowserViewForBrowser(browser); | 1030 BrowserView::GetBrowserViewForBrowser(browser); |
| 1028 views::Widget* dragged_widget = dragged_browser_view->GetWidget(); | 1031 views::Widget* dragged_widget = dragged_browser_view->GetWidget(); |
| 1032 | |
| 1033 #if defined(USE_AURA) | |
| 1034 // Only Aura windows are gesture consumers. | |
| 1029 gfx::NativeView attached_native_view = | 1035 gfx::NativeView attached_native_view = |
| 1030 attached_tabstrip_->GetWidget()->GetNativeView(); | 1036 attached_tabstrip_->GetWidget()->GetNativeView(); |
| 1031 | |
| 1032 ui::GestureRecognizer::Get()->TransferEventsTo( | 1037 ui::GestureRecognizer::Get()->TransferEventsTo( |
| 1033 attached_native_view, dragged_widget->GetNativeView()); | 1038 attached_native_view, dragged_widget->GetNativeView()); |
| 1039 #endif | |
| 1034 | 1040 |
| 1035 Detach(can_release_capture_ ? RELEASE_CAPTURE : DONT_RELEASE_CAPTURE); | 1041 Detach(can_release_capture_ ? RELEASE_CAPTURE : DONT_RELEASE_CAPTURE); |
| 1036 | 1042 |
| 1037 dragged_widget->SetVisibilityChangedAnimationsEnabled(false); | 1043 dragged_widget->SetVisibilityChangedAnimationsEnabled(false); |
| 1038 Attach(dragged_browser_view->tabstrip(), gfx::Point()); | 1044 Attach(dragged_browser_view->tabstrip(), gfx::Point()); |
| 1039 AdjustBrowserAndTabBoundsForDrag(last_tabstrip_width, | 1045 AdjustBrowserAndTabBoundsForDrag(last_tabstrip_width, |
| 1040 point_in_screen, | 1046 point_in_screen, |
| 1041 &drag_bounds); | 1047 &drag_bounds); |
| 1042 WindowPositionManagedUpdater updater; | 1048 WindowPositionManagedUpdater updater; |
| 1043 dragged_widget->AddObserver(&updater); | 1049 dragged_widget->AddObserver(&updater); |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1790 it != browser_list->end(); ++it) { | 1796 it != browser_list->end(); ++it) { |
| 1791 if ((*it)->tab_strip_model()->empty()) | 1797 if ((*it)->tab_strip_model()->empty()) |
| 1792 exclude.insert((*it)->window()->GetNativeWindow()); | 1798 exclude.insert((*it)->window()->GetNativeWindow()); |
| 1793 } | 1799 } |
| 1794 #endif | 1800 #endif |
| 1795 return GetLocalProcessWindowAtPoint(host_desktop_type_, | 1801 return GetLocalProcessWindowAtPoint(host_desktop_type_, |
| 1796 screen_point, | 1802 screen_point, |
| 1797 exclude); | 1803 exclude); |
| 1798 | 1804 |
| 1799 } | 1805 } |
| OLD | NEW |