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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 // Distance from the next/previous stacked before before we consider the tab | 78 // Distance from the next/previous stacked before before we consider the tab |
79 // close enough to trigger moving. | 79 // close enough to trigger moving. |
80 const int kStackedDistance = 36; | 80 const int kStackedDistance = 36; |
81 | 81 |
82 // A dragged window is forced to be a bit smaller than maximized bounds during a | 82 // A dragged window is forced to be a bit smaller than maximized bounds during a |
83 // drag. This prevents the dragged browser widget from getting maximized at | 83 // drag. This prevents the dragged browser widget from getting maximized at |
84 // creation and makes it easier to drag tabs out of a restored window that had | 84 // creation and makes it easier to drag tabs out of a restored window that had |
85 // maximized size. | 85 // maximized size. |
86 const int kMaximizedWindowInset = 10; // DIPs. | 86 const int kMaximizedWindowInset = 10; // DIPs. |
87 | 87 |
88 // Whether a new browser window created during a drag is destroyed immediately | |
89 // once it is associated with a new tab strip. If false, windows created during | |
90 // the drag are destroyed only when the drag ends. | |
91 #if 0 && defined(OS_MACOSX) | |
tapted
2016/03/01 08:11:58
So, this doesn't work yet. It's fine for a follow-
themblsha
2016/03/09 17:40:22
Done.
| |
92 const bool windows_destroy_during_drag = false; | |
93 #else | |
94 const bool windows_destroy_during_drag = true; | |
95 #endif | |
96 | |
88 #if defined(USE_ASH) | 97 #if defined(USE_ASH) |
89 void SetWindowPositionManaged(gfx::NativeWindow window, bool value) { | 98 void SetWindowPositionManaged(gfx::NativeWindow window, bool value) { |
90 ash::wm::GetWindowState(window)->set_window_position_managed(value); | 99 ash::wm::GetWindowState(window)->set_window_position_managed(value); |
91 } | 100 } |
92 | 101 |
93 // Returns true if |tab_strip| browser window is docked. | 102 // Returns true if |tab_strip| browser window is docked. |
94 bool IsDockedOrSnapped(const TabStrip* tab_strip) { | 103 bool IsDockedOrSnapped(const TabStrip* tab_strip) { |
95 DCHECK(tab_strip); | 104 DCHECK(tab_strip); |
96 ash::wm::WindowState* window_state = | 105 ash::wm::WindowState* window_state = |
97 ash::wm::GetWindowState(tab_strip->GetWidget()->GetNativeWindow()); | 106 ash::wm::GetWindowState(tab_strip->GetWidget()->GetNativeWindow()); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
265 // - Desktop Linux | 274 // - Desktop Linux |
266 // Mouse capture is not synchronous on desktop Linux. Chrome makes | 275 // Mouse capture is not synchronous on desktop Linux. Chrome makes |
267 // transferring capture between widgets without releasing capture appear | 276 // transferring capture between widgets without releasing capture appear |
268 // synchronous on desktop Linux, so use that. | 277 // synchronous on desktop Linux, so use that. |
269 // - Ash | 278 // - Ash |
270 // Releasing capture on Ash cancels gestures so avoid it. | 279 // Releasing capture on Ash cancels gestures so avoid it. |
271 #if defined(OS_LINUX) || defined(USE_ASH) | 280 #if defined(OS_LINUX) || defined(USE_ASH) |
272 can_release_capture_ = false; | 281 can_release_capture_ = false; |
273 #endif | 282 #endif |
274 start_point_in_screen_ = gfx::Point(source_tab_offset, mouse_offset.y()); | 283 start_point_in_screen_ = gfx::Point(source_tab_offset, mouse_offset.y()); |
284 DLOG(INFO) << "TabDragController::Init/mouse offset -> point_in_window=" | |
285 << mouse_offset.ToString() << " -> " | |
286 << start_point_in_screen_.ToString(); | |
275 views::View::ConvertPointToScreen(source_tab, &start_point_in_screen_); | 287 views::View::ConvertPointToScreen(source_tab, &start_point_in_screen_); |
288 DLOG(INFO) << " --> in screen=" << start_point_in_screen_.ToString(); | |
289 | |
276 event_source_ = event_source; | 290 event_source_ = event_source; |
277 mouse_offset_ = mouse_offset; | 291 mouse_offset_ = mouse_offset; |
278 move_behavior_ = move_behavior; | 292 move_behavior_ = move_behavior; |
279 last_point_in_screen_ = start_point_in_screen_; | 293 last_point_in_screen_ = start_point_in_screen_; |
280 last_move_screen_loc_ = start_point_in_screen_.x(); | 294 last_move_screen_loc_ = start_point_in_screen_.x(); |
281 initial_tab_positions_ = source_tabstrip->GetTabXCoordinates(); | 295 initial_tab_positions_ = source_tabstrip->GetTabXCoordinates(); |
282 | 296 |
283 GetModel(source_tabstrip_)->AddObserver(this); | 297 GetModel(source_tabstrip_)->AddObserver(this); |
284 | 298 |
285 drag_data_.resize(tabs.size()); | 299 drag_data_.resize(tabs.size()); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 void TabDragController::Drag(const gfx::Point& point_in_screen) { | 351 void TabDragController::Drag(const gfx::Point& point_in_screen) { |
338 TRACE_EVENT1("views", "TabDragController::Drag", | 352 TRACE_EVENT1("views", "TabDragController::Drag", |
339 "point_in_screen", point_in_screen.ToString()); | 353 "point_in_screen", point_in_screen.ToString()); |
340 | 354 |
341 bring_to_front_timer_.Stop(); | 355 bring_to_front_timer_.Stop(); |
342 move_stacked_timer_.Stop(); | 356 move_stacked_timer_.Stop(); |
343 | 357 |
344 if (waiting_for_run_loop_to_exit_) | 358 if (waiting_for_run_loop_to_exit_) |
345 return; | 359 return; |
346 | 360 |
361 DLOG(INFO) << "Started_drag = " << started_drag_; | |
362 | |
347 if (!started_drag_) { | 363 if (!started_drag_) { |
348 if (!CanStartDrag(point_in_screen)) | 364 if (!CanStartDrag(point_in_screen)) |
349 return; // User hasn't dragged far enough yet. | 365 return; // User hasn't dragged far enough yet. |
350 | 366 |
367 DLOG(INFO) << "STARTING!"; | |
368 | |
351 // On windows SaveFocus() may trigger a capture lost, which destroys us. | 369 // On windows SaveFocus() may trigger a capture lost, which destroys us. |
352 { | 370 { |
353 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); | 371 base::WeakPtr<TabDragController> ref(weak_factory_.GetWeakPtr()); |
354 SaveFocus(); | 372 SaveFocus(); |
355 if (!ref) | 373 if (!ref) |
356 return; | 374 return; |
357 } | 375 } |
376 DLOG(INFO) << "Starting drag"; | |
358 started_drag_ = true; | 377 started_drag_ = true; |
359 Attach(source_tabstrip_, gfx::Point()); | 378 Attach(source_tabstrip_, gfx::Point()); |
360 if (static_cast<int>(drag_data_.size()) == | 379 if (static_cast<int>(drag_data_.size()) == |
361 GetModel(source_tabstrip_)->count()) { | 380 GetModel(source_tabstrip_)->count()) { |
362 if (was_source_maximized_ || was_source_fullscreen_) { | 381 if (was_source_maximized_ || was_source_fullscreen_) { |
363 did_restore_window_ = true; | 382 did_restore_window_ = true; |
364 // When all tabs in a maximized browser are dragged the browser gets | 383 // When all tabs in a maximized browser are dragged the browser gets |
365 // restored during the drag and maximized back when the drag ends. | 384 // restored during the drag and maximized back when the drag ends. |
366 views::Widget* widget = GetAttachedBrowserWidget(); | 385 views::Widget* widget = GetAttachedBrowserWidget(); |
367 const int last_tabstrip_width = attached_tabstrip_->GetTabAreaWidth(); | 386 const int last_tabstrip_width = attached_tabstrip_->GetTabAreaWidth(); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
516 return; | 535 return; |
517 old_focused_view->GetFocusManager()->SetFocusedView(old_focused_view); | 536 old_focused_view->GetFocusManager()->SetFocusedView(old_focused_view); |
518 } | 537 } |
519 | 538 |
520 bool TabDragController::CanStartDrag(const gfx::Point& point_in_screen) const { | 539 bool TabDragController::CanStartDrag(const gfx::Point& point_in_screen) const { |
521 // Determine if the mouse has moved beyond a minimum elasticity distance in | 540 // Determine if the mouse has moved beyond a minimum elasticity distance in |
522 // any direction from the starting point. | 541 // any direction from the starting point. |
523 static const int kMinimumDragDistance = 10; | 542 static const int kMinimumDragDistance = 10; |
524 int x_offset = abs(point_in_screen.x() - start_point_in_screen_.x()); | 543 int x_offset = abs(point_in_screen.x() - start_point_in_screen_.x()); |
525 int y_offset = abs(point_in_screen.y() - start_point_in_screen_.y()); | 544 int y_offset = abs(point_in_screen.y() - start_point_in_screen_.y()); |
526 return sqrt(pow(static_cast<float>(x_offset), 2) + | 545 bool result = sqrt(pow(static_cast<float>(x_offset), 2) + |
527 pow(static_cast<float>(y_offset), 2)) > kMinimumDragDistance; | 546 pow(static_cast<float>(y_offset), 2)) > kMinimumDragDistance; |
547 DLOG(INFO) << start_point_in_screen_.ToString() << " , " | |
548 << point_in_screen.ToString(); | |
549 DLOG(INFO) << "can start = " << result; | |
550 return result; | |
528 } | 551 } |
529 | 552 |
530 void TabDragController::ContinueDragging(const gfx::Point& point_in_screen) { | 553 void TabDragController::ContinueDragging(const gfx::Point& point_in_screen) { |
531 TRACE_EVENT1("views", "TabDragController::ContinueDragging", | 554 TRACE_EVENT1("views", "TabDragController::ContinueDragging", |
532 "point_in_screen", point_in_screen.ToString()); | 555 "point_in_screen", point_in_screen.ToString()); |
556 DLOG(INFO) << "ContinueDragging... point_in_screen=" | |
557 << point_in_screen.ToString(); | |
533 | 558 |
534 DCHECK(attached_tabstrip_); | 559 DCHECK(attached_tabstrip_); |
535 | 560 |
536 TabStrip* target_tabstrip = detach_behavior_ == DETACHABLE ? | 561 TabStrip* target_tabstrip = detach_behavior_ == DETACHABLE ? |
537 GetTargetTabStripForPoint(point_in_screen) : source_tabstrip_; | 562 GetTargetTabStripForPoint(point_in_screen) : source_tabstrip_; |
538 bool tab_strip_changed = (target_tabstrip != attached_tabstrip_); | 563 bool tab_strip_changed = (target_tabstrip != attached_tabstrip_); |
539 | 564 |
540 if (attached_tabstrip_) { | 565 if (attached_tabstrip_) { |
541 int move_delta = point_in_screen.x() - last_point_in_screen_.x(); | 566 int move_delta = point_in_screen.x() - last_point_in_screen_.x(); |
542 if (move_delta > 0) | 567 if (move_delta > 0) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
600 // observer so we don't get notified and process the event. | 625 // observer so we don't get notified and process the event. |
601 #if defined(USE_ASH) | 626 #if defined(USE_ASH) |
602 move_loop_widget_->RemoveObserver(this); | 627 move_loop_widget_->RemoveObserver(this); |
603 move_loop_widget_ = nullptr; | 628 move_loop_widget_ = nullptr; |
604 #endif // USE_ASH | 629 #endif // USE_ASH |
605 views::Widget* browser_widget = GetAttachedBrowserWidget(); | 630 views::Widget* browser_widget = GetAttachedBrowserWidget(); |
606 // Need to release the drag controller before starting the move loop as it's | 631 // Need to release the drag controller before starting the move loop as it's |
607 // going to trigger capture lost, which cancels drag. | 632 // going to trigger capture lost, which cancels drag. |
608 attached_tabstrip_->ReleaseDragController(); | 633 attached_tabstrip_->ReleaseDragController(); |
609 target_tabstrip->OwnDragController(this); | 634 target_tabstrip->OwnDragController(this); |
635 if (!windows_destroy_during_drag) { | |
636 Detach(DONT_RELEASE_CAPTURE); | |
637 Attach(target_tabstrip, point_in_screen); | |
638 // Move the tabs into position. | |
639 // MoveAttached(point_in_screen); // assumes !is_dragging_window_ | |
640 return DRAG_BROWSER_RESULT_CONTINUE; | |
641 } | |
642 | |
610 // Disable animations so that we don't see a close animation on aero. | 643 // Disable animations so that we don't see a close animation on aero. |
611 browser_widget->SetVisibilityChangedAnimationsEnabled(false); | 644 browser_widget->SetVisibilityChangedAnimationsEnabled(false); |
612 if (can_release_capture_) | 645 if (can_release_capture_) |
613 browser_widget->ReleaseCapture(); | 646 browser_widget->ReleaseCapture(); |
614 else | 647 else |
615 target_tabstrip->GetWidget()->SetCapture(attached_tabstrip_); | 648 target_tabstrip->GetWidget()->SetCapture(attached_tabstrip_); |
616 | 649 |
617 // The window is going away. Since the drag is still on going we don't want | 650 // The window is going away. Since the drag is still on going we don't want |
618 // that to effect the position of any windows. | 651 // that to effect the position of any windows. |
619 SetWindowPositionManaged(browser_widget->GetNativeWindow(), false); | 652 SetWindowPositionManaged(browser_widget->GetNativeWindow(), false); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
815 return DETACH_AFTER; | 848 return DETACH_AFTER; |
816 return DETACH_ABOVE_OR_BELOW; | 849 return DETACH_ABOVE_OR_BELOW; |
817 } | 850 } |
818 | 851 |
819 TabStrip* TabDragController::GetTargetTabStripForPoint( | 852 TabStrip* TabDragController::GetTargetTabStripForPoint( |
820 const gfx::Point& point_in_screen) { | 853 const gfx::Point& point_in_screen) { |
821 TRACE_EVENT1("views", "TabDragController::GetTargetTabStripForPoint", | 854 TRACE_EVENT1("views", "TabDragController::GetTargetTabStripForPoint", |
822 "point_in_screen", point_in_screen.ToString()); | 855 "point_in_screen", point_in_screen.ToString()); |
823 | 856 |
824 if (move_only() && attached_tabstrip_) { | 857 if (move_only() && attached_tabstrip_) { |
858 DLOG(INFO) << "MoveOnly"; | |
825 // move_only() is intended for touch, in which case we only want to detach | 859 // move_only() is intended for touch, in which case we only want to detach |
826 // if the touch point moves significantly in the vertical distance. | 860 // if the touch point moves significantly in the vertical distance. |
827 gfx::Rect tabstrip_bounds = GetViewScreenBounds(attached_tabstrip_); | 861 gfx::Rect tabstrip_bounds = GetViewScreenBounds(attached_tabstrip_); |
828 if (DoesRectContainVerticalPointExpanded(tabstrip_bounds, | 862 if (DoesRectContainVerticalPointExpanded(tabstrip_bounds, |
829 kTouchVerticalDetachMagnetism, | 863 kTouchVerticalDetachMagnetism, |
830 point_in_screen.y())) | 864 point_in_screen.y())) |
831 return attached_tabstrip_; | 865 return attached_tabstrip_; |
832 } | 866 } |
833 gfx::NativeWindow local_window = | 867 gfx::NativeWindow local_window = |
834 GetLocalProcessWindow(point_in_screen, is_dragging_window_); | 868 GetLocalProcessWindow(point_in_screen, is_dragging_window_); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
882 "point_in_screen", point_in_screen.ToString()); | 916 "point_in_screen", point_in_screen.ToString()); |
883 | 917 |
884 DCHECK(!attached_tabstrip_); // We should already have detached by the time | 918 DCHECK(!attached_tabstrip_); // We should already have detached by the time |
885 // we get here. | 919 // we get here. |
886 | 920 |
887 attached_tabstrip_ = attached_tabstrip; | 921 attached_tabstrip_ = attached_tabstrip; |
888 | 922 |
889 std::vector<Tab*> tabs = | 923 std::vector<Tab*> tabs = |
890 GetTabsMatchingDraggedContents(attached_tabstrip_); | 924 GetTabsMatchingDraggedContents(attached_tabstrip_); |
891 | 925 |
926 bool acquire_capture = true; | |
927 | |
892 if (tabs.empty()) { | 928 if (tabs.empty()) { |
893 // Transitioning from detached to attached to a new tabstrip. Add tabs to | 929 // Transitioning from detached to attached to a new tabstrip. Add tabs to |
894 // the new model. | 930 // the new model. |
895 | 931 |
896 selection_model_before_attach_.Copy(attached_tabstrip->GetSelectionModel()); | 932 selection_model_before_attach_.Copy(attached_tabstrip->GetSelectionModel()); |
897 | 933 |
898 // Inserting counts as a move. We don't want the tabs to jitter when the | 934 // Inserting counts as a move. We don't want the tabs to jitter when the |
899 // user moves the tab immediately after attaching it. | 935 // user moves the tab immediately after attaching it. |
900 last_move_screen_loc_ = point_in_screen.x(); | 936 last_move_screen_loc_ = point_in_screen.x(); |
901 | 937 |
(...skipping 19 matching lines...) Expand all Loading... | |
921 DCHECK_EQ(1u, drag_data_.size()); | 957 DCHECK_EQ(1u, drag_data_.size()); |
922 add_types |= TabStripModel::ADD_ACTIVE; | 958 add_types |= TabStripModel::ADD_ACTIVE; |
923 } | 959 } |
924 if (drag_data_[i].pinned) | 960 if (drag_data_[i].pinned) |
925 add_types |= TabStripModel::ADD_PINNED; | 961 add_types |= TabStripModel::ADD_PINNED; |
926 GetModel(attached_tabstrip_)->InsertWebContentsAt( | 962 GetModel(attached_tabstrip_)->InsertWebContentsAt( |
927 index + i, drag_data_[i].contents, add_types); | 963 index + i, drag_data_[i].contents, add_types); |
928 } | 964 } |
929 | 965 |
930 tabs = GetTabsMatchingDraggedContents(attached_tabstrip_); | 966 tabs = GetTabsMatchingDraggedContents(attached_tabstrip_); |
967 | |
968 // If the windows are kept, there's no need to re-acquire capture. Instead, | |
969 // the TabDragController remains in a MoveLoop. | |
970 acquire_capture = windows_destroy_during_drag; | |
931 } | 971 } |
932 DCHECK_EQ(tabs.size(), drag_data_.size()); | 972 DCHECK_EQ(tabs.size(), drag_data_.size()); |
933 for (size_t i = 0; i < drag_data_.size(); ++i) | 973 for (size_t i = 0; i < drag_data_.size(); ++i) |
934 drag_data_[i].attached_tab = tabs[i]; | 974 drag_data_[i].attached_tab = tabs[i]; |
935 | 975 |
936 attached_tabstrip_->StartedDraggingTabs(tabs); | 976 attached_tabstrip_->StartedDraggingTabs(tabs); |
937 | 977 |
938 ResetSelection(GetModel(attached_tabstrip_)); | 978 ResetSelection(GetModel(attached_tabstrip_)); |
939 | 979 |
940 // The size of the dragged tab may have changed. Adjust the x offset so that | 980 // The size of the dragged tab may have changed. Adjust the x offset so that |
941 // ratio of mouse_offset_ to original width is maintained. | 981 // ratio of mouse_offset_ to original width is maintained. |
942 std::vector<Tab*> tabs_to_source(tabs); | 982 std::vector<Tab*> tabs_to_source(tabs); |
943 tabs_to_source.erase(tabs_to_source.begin() + source_tab_index_ + 1, | 983 tabs_to_source.erase(tabs_to_source.begin() + source_tab_index_ + 1, |
944 tabs_to_source.end()); | 984 tabs_to_source.end()); |
945 int new_x = attached_tabstrip_->GetSizeNeededForTabs(tabs_to_source) - | 985 int new_x = attached_tabstrip_->GetSizeNeededForTabs(tabs_to_source) - |
946 tabs[source_tab_index_]->width() + | 986 tabs[source_tab_index_]->width() + |
947 static_cast<int>(offset_to_width_ratio_ * | 987 static_cast<int>(offset_to_width_ratio_ * |
948 tabs[source_tab_index_]->width()); | 988 tabs[source_tab_index_]->width()); |
949 mouse_offset_.set_x(new_x); | 989 mouse_offset_.set_x(new_x); |
950 | 990 |
951 // Transfer ownership of us to the new tabstrip as well as making sure the | 991 // Transfer ownership of us to the new tabstrip as well as making sure the |
952 // window has capture. This is important so that if activation changes the | 992 // window has capture. This is important so that if activation changes the |
953 // drag isn't prematurely canceled. | 993 // drag isn't prematurely canceled. |
954 attached_tabstrip_->GetWidget()->SetCapture(attached_tabstrip_); | 994 if (acquire_capture) |
995 attached_tabstrip_->GetWidget()->SetCapture(attached_tabstrip_); | |
955 attached_tabstrip_->OwnDragController(this); | 996 attached_tabstrip_->OwnDragController(this); |
956 } | 997 } |
957 | 998 |
958 void TabDragController::Detach(ReleaseCapture release_capture) { | 999 void TabDragController::Detach(ReleaseCapture release_capture) { |
959 TRACE_EVENT1("views", "TabDragController::Detach", | 1000 TRACE_EVENT1("views", "TabDragController::Detach", |
960 "release_capture", release_capture); | 1001 "release_capture", release_capture); |
961 | 1002 |
962 attach_index_ = -1; | 1003 attach_index_ = -1; |
963 | 1004 |
964 // When the user detaches we assume they want to reorder. | 1005 // When the user detaches we assume they want to reorder. |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1737 | 1778 |
1738 Profile* profile = | 1779 Profile* profile = |
1739 Profile::FromBrowserContext(drag_data_[0].contents->GetBrowserContext()); | 1780 Profile::FromBrowserContext(drag_data_[0].contents->GetBrowserContext()); |
1740 Browser::CreateParams create_params(Browser::TYPE_TABBED, profile); | 1781 Browser::CreateParams create_params(Browser::TYPE_TABBED, profile); |
1741 create_params.initial_bounds = new_bounds; | 1782 create_params.initial_bounds = new_bounds; |
1742 Browser* browser = new Browser(create_params); | 1783 Browser* browser = new Browser(create_params); |
1743 is_dragging_new_browser_ = true; | 1784 is_dragging_new_browser_ = true; |
1744 SetWindowPositionManaged(browser->window()->GetNativeWindow(), false); | 1785 SetWindowPositionManaged(browser->window()->GetNativeWindow(), false); |
1745 // If the window is created maximized then the bounds we supplied are ignored. | 1786 // If the window is created maximized then the bounds we supplied are ignored. |
1746 // We need to reset them again so they are honored. | 1787 // We need to reset them again so they are honored. |
1788 DLOG(INFO) << "SetBounds -> " << new_bounds.ToString(); | |
1747 browser->window()->SetBounds(new_bounds); | 1789 browser->window()->SetBounds(new_bounds); |
1748 | 1790 |
1749 return browser; | 1791 return browser; |
1750 } | 1792 } |
1751 | 1793 |
1752 gfx::Point TabDragController::GetCursorScreenPoint() { | 1794 gfx::Point TabDragController::GetCursorScreenPoint() { |
1753 #if defined(USE_ASH) | 1795 #if defined(USE_ASH) |
1754 if (event_source_ == EVENT_SOURCE_TOUCH && | 1796 if (event_source_ == EVENT_SOURCE_TOUCH && |
1755 aura::Env::GetInstance()->is_touch_down()) { | 1797 aura::Env::GetInstance()->is_touch_down()) { |
1756 views::Widget* widget = GetAttachedBrowserWidget(); | 1798 views::Widget* widget = GetAttachedBrowserWidget(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1797 // window which was used for dragging is not hidden once all of its tabs are | 1839 // window which was used for dragging is not hidden once all of its tabs are |
1798 // attached to another browser window in DragBrowserToNewTabStrip(). | 1840 // attached to another browser window in DragBrowserToNewTabStrip(). |
1799 // TODO(pkotwicz): Fix this properly (crbug.com/358482) | 1841 // TODO(pkotwicz): Fix this properly (crbug.com/358482) |
1800 for (auto* browser : *BrowserList::GetInstance()) { | 1842 for (auto* browser : *BrowserList::GetInstance()) { |
1801 if (browser->tab_strip_model()->empty()) | 1843 if (browser->tab_strip_model()->empty()) |
1802 exclude.insert(browser->window()->GetNativeWindow()); | 1844 exclude.insert(browser->window()->GetNativeWindow()); |
1803 } | 1845 } |
1804 #endif | 1846 #endif |
1805 return GetLocalProcessWindowAtPoint(screen_point, exclude); | 1847 return GetLocalProcessWindowAtPoint(screen_point, exclude); |
1806 } | 1848 } |
OLD | NEW |