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 20 matching lines...) Expand all Loading... |
31 #include "extensions/browser/extension_function_dispatcher.h" | 31 #include "extensions/browser/extension_function_dispatcher.h" |
32 #include "ui/aura/env.h" | 32 #include "ui/aura/env.h" |
33 #include "ui/aura/window.h" | 33 #include "ui/aura/window.h" |
34 #include "ui/events/event_constants.h" | 34 #include "ui/events/event_constants.h" |
35 #include "ui/events/gestures/gesture_recognizer.h" | 35 #include "ui/events/gestures/gesture_recognizer.h" |
36 #include "ui/gfx/geometry/point_conversions.h" | 36 #include "ui/gfx/geometry/point_conversions.h" |
37 #include "ui/gfx/screen.h" | 37 #include "ui/gfx/screen.h" |
38 #include "ui/views/focus/view_storage.h" | 38 #include "ui/views/focus/view_storage.h" |
39 #include "ui/views/widget/root_view.h" | 39 #include "ui/views/widget/root_view.h" |
40 #include "ui/views/widget/widget.h" | 40 #include "ui/views/widget/widget.h" |
41 #include "ui/wm/core/coordinate_conversion.h" | |
42 #include "ui/wm/core/window_modality_controller.h" | |
43 | 41 |
44 #if defined(USE_ASH) | 42 #if defined(USE_ASH) |
45 #include "ash/accelerators/accelerator_commands.h" | 43 #include "ash/accelerators/accelerator_commands.h" |
46 #include "ash/shell.h" | 44 #include "ash/shell.h" |
47 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 45 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
48 #include "ash/wm/window_state.h" | 46 #include "ash/wm/window_state.h" |
| 47 #include "ui/wm/core/coordinate_conversion.h" |
| 48 #endif |
| 49 |
| 50 #if defined(USE_AURA) |
| 51 #include "ui/wm/core/window_modality_controller.h" |
49 #endif | 52 #endif |
50 | 53 |
51 using base::UserMetricsAction; | 54 using base::UserMetricsAction; |
52 using content::OpenURLParams; | 55 using content::OpenURLParams; |
53 using content::WebContents; | 56 using content::WebContents; |
54 | 57 |
55 // If non-null there is a drag underway. | 58 // If non-null there is a drag underway. |
56 static TabDragController* instance_ = NULL; | 59 static TabDragController* instance_ = NULL; |
57 | 60 |
58 namespace { | 61 namespace { |
(...skipping 28 matching lines...) Expand all Loading... |
87 } | 90 } |
88 #else | 91 #else |
89 void SetWindowPositionManaged(gfx::NativeWindow window, bool value) { | 92 void SetWindowPositionManaged(gfx::NativeWindow window, bool value) { |
90 } | 93 } |
91 | 94 |
92 bool IsDockedOrSnapped(const TabStrip* tab_strip) { | 95 bool IsDockedOrSnapped(const TabStrip* tab_strip) { |
93 return false; | 96 return false; |
94 } | 97 } |
95 #endif | 98 #endif |
96 | 99 |
| 100 #if defined(USE_AURA) |
| 101 gfx::NativeWindow GetModalTransient(gfx::NativeWindow window) { |
| 102 return wm::GetModalTransient(window); |
| 103 } |
| 104 #else |
| 105 gfx::NativeWindow GetModalTransient(gfx::NativeWindow window) { |
| 106 NOTIMPLEMENTED(); |
| 107 return NULL; |
| 108 } |
| 109 #endif |
| 110 |
97 // Returns true if |bounds| contains the y-coordinate |y|. The y-coordinate | 111 // Returns true if |bounds| contains the y-coordinate |y|. The y-coordinate |
98 // of |bounds| is adjusted by |vertical_adjustment|. | 112 // of |bounds| is adjusted by |vertical_adjustment|. |
99 bool DoesRectContainVerticalPointExpanded( | 113 bool DoesRectContainVerticalPointExpanded( |
100 const gfx::Rect& bounds, | 114 const gfx::Rect& bounds, |
101 int vertical_adjustment, | 115 int vertical_adjustment, |
102 int y) { | 116 int y) { |
103 int upper_threshold = bounds.bottom() + vertical_adjustment; | 117 int upper_threshold = bounds.bottom() + vertical_adjustment; |
104 int lower_threshold = bounds.y() - vertical_adjustment; | 118 int lower_threshold = bounds.y() - vertical_adjustment; |
105 return y >= lower_threshold && y <= upper_threshold; | 119 return y >= lower_threshold && y <= upper_threshold; |
106 } | 120 } |
107 | 121 |
108 // Adds |x_offset| to all the rectangles in |rects|. | 122 // Adds |x_offset| to all the rectangles in |rects|. |
109 void OffsetX(int x_offset, std::vector<gfx::Rect>* rects) { | 123 void OffsetX(int x_offset, std::vector<gfx::Rect>* rects) { |
110 if (x_offset == 0) | 124 if (x_offset == 0) |
111 return; | 125 return; |
112 | 126 |
113 for (size_t i = 0; i < rects->size(); ++i) | 127 for (size_t i = 0; i < rects->size(); ++i) |
114 (*rects)[i].set_x((*rects)[i].x() + x_offset); | 128 (*rects)[i].set_x((*rects)[i].x() + x_offset); |
115 } | 129 } |
116 | 130 |
117 // WidgetObserver implementation that resets the window position managed | 131 // WidgetObserver implementation that resets the window position managed |
118 // property on Show. | 132 // property on Show. |
119 // We're forced to do this here since BrowserFrameAsh resets the 'window | 133 // We're forced to do this here since BrowserFrameAsh resets the 'window |
120 // position managed' property during a show and we need the property set to | 134 // position managed' property during a show and we need the property set to |
121 // false before WorkspaceLayoutManager sees the visibility change. | 135 // false before WorkspaceLayoutManager sees the visibility change. |
122 class WindowPositionManagedUpdater : public views::WidgetObserver { | 136 class WindowPositionManagedUpdater : public views::WidgetObserver { |
123 public: | 137 public: |
124 virtual void OnWidgetVisibilityChanged(views::Widget* widget, | 138 virtual void OnWidgetVisibilityChanged(views::Widget* widget, |
125 bool visible) override { | 139 bool visible) override { |
126 SetWindowPositionManaged(widget->GetNativeView(), false); | 140 SetWindowPositionManaged(widget->GetNativeWindow(), false); |
127 } | 141 } |
128 }; | 142 }; |
129 | 143 |
130 // EscapeTracker installs itself as a pre-target handler on aura::Env and runs a | 144 // EscapeTracker installs itself as a pre-target handler on aura::Env and runs a |
131 // callback when it receives the escape key. | 145 // callback when it receives the escape key. |
132 class EscapeTracker : public ui::EventHandler { | 146 class EscapeTracker : public ui::EventHandler { |
133 public: | 147 public: |
134 explicit EscapeTracker(const base::Closure& callback) | 148 explicit EscapeTracker(const base::Closure& callback) |
135 : escape_callback_(callback) { | 149 : escape_callback_(callback) { |
136 aura::Env::GetInstance()->AddPreTargetHandler(this); | 150 aura::Env::GetInstance()->AddPreTargetHandler(this); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 224 } |
211 | 225 |
212 TabDragController::~TabDragController() { | 226 TabDragController::~TabDragController() { |
213 views::ViewStorage::GetInstance()->RemoveView(old_focused_view_id_); | 227 views::ViewStorage::GetInstance()->RemoveView(old_focused_view_id_); |
214 | 228 |
215 if (instance_ == this) | 229 if (instance_ == this) |
216 instance_ = NULL; | 230 instance_ = NULL; |
217 | 231 |
218 if (move_loop_widget_) { | 232 if (move_loop_widget_) { |
219 move_loop_widget_->RemoveObserver(this); | 233 move_loop_widget_->RemoveObserver(this); |
220 SetWindowPositionManaged(move_loop_widget_->GetNativeView(), true); | 234 SetWindowPositionManaged(move_loop_widget_->GetNativeWindow(), true); |
221 } | 235 } |
222 | 236 |
223 if (source_tabstrip_) | 237 if (source_tabstrip_) |
224 GetModel(source_tabstrip_)->RemoveObserver(this); | 238 GetModel(source_tabstrip_)->RemoveObserver(this); |
225 | 239 |
226 if (event_source_ == EVENT_SOURCE_TOUCH) { | 240 if (event_source_ == EVENT_SOURCE_TOUCH) { |
227 TabStrip* capture_tabstrip = attached_tabstrip_ ? | 241 TabStrip* capture_tabstrip = attached_tabstrip_ ? |
228 attached_tabstrip_ : source_tabstrip_; | 242 attached_tabstrip_ : source_tabstrip_; |
229 capture_tabstrip->GetWidget()->ReleaseCapture(); | 243 capture_tabstrip->GetWidget()->ReleaseCapture(); |
230 } | 244 } |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 // should really be done somewhere in capture change code and or inside the | 615 // should really be done somewhere in capture change code and or inside the |
602 // GR. But we currently do not have a consistent way for doing it that would | 616 // GR. But we currently do not have a consistent way for doing it that would |
603 // work in all cases. Hence this hack. | 617 // work in all cases. Hence this hack. |
604 ui::GestureRecognizer::Get()->TransferEventsTo( | 618 ui::GestureRecognizer::Get()->TransferEventsTo( |
605 browser_widget->GetNativeView(), | 619 browser_widget->GetNativeView(), |
606 target_tabstrip->GetWidget()->GetNativeView()); | 620 target_tabstrip->GetWidget()->GetNativeView()); |
607 #endif | 621 #endif |
608 | 622 |
609 // The window is going away. Since the drag is still on going we don't want | 623 // The window is going away. Since the drag is still on going we don't want |
610 // that to effect the position of any windows. | 624 // that to effect the position of any windows. |
611 SetWindowPositionManaged(browser_widget->GetNativeView(), false); | 625 SetWindowPositionManaged(browser_widget->GetNativeWindow(), false); |
612 | 626 |
613 #if !defined(OS_LINUX) || defined(OS_CHROMEOS) | 627 #if !defined(OS_LINUX) || defined(OS_CHROMEOS) |
614 // EndMoveLoop is going to snap the window back to its original location. | 628 // EndMoveLoop is going to snap the window back to its original location. |
615 // Hide it so users don't see this. Hiding a window in Linux aura causes | 629 // Hide it so users don't see this. Hiding a window in Linux aura causes |
616 // it to lose capture so skip it. | 630 // it to lose capture so skip it. |
617 browser_widget->Hide(); | 631 browser_widget->Hide(); |
618 #endif | 632 #endif |
619 browser_widget->EndMoveLoop(); | 633 browser_widget->EndMoveLoop(); |
620 | 634 |
621 // Ideally we would always swap the tabs now, but on non-ash Windows, it | 635 // Ideally we would always swap the tabs now, but on non-ash Windows, it |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 gfx::Rect tabstrip_bounds = GetViewScreenBounds(attached_tabstrip_); | 833 gfx::Rect tabstrip_bounds = GetViewScreenBounds(attached_tabstrip_); |
820 if (DoesRectContainVerticalPointExpanded(tabstrip_bounds, | 834 if (DoesRectContainVerticalPointExpanded(tabstrip_bounds, |
821 kTouchVerticalDetachMagnetism, | 835 kTouchVerticalDetachMagnetism, |
822 point_in_screen.y())) | 836 point_in_screen.y())) |
823 return attached_tabstrip_; | 837 return attached_tabstrip_; |
824 } | 838 } |
825 gfx::NativeWindow local_window = | 839 gfx::NativeWindow local_window = |
826 GetLocalProcessWindow(point_in_screen, is_dragging_window_); | 840 GetLocalProcessWindow(point_in_screen, is_dragging_window_); |
827 // Do not allow dragging into a window with a modal dialog, it causes a weird | 841 // Do not allow dragging into a window with a modal dialog, it causes a weird |
828 // behavior. See crbug.com/336691 | 842 // behavior. See crbug.com/336691 |
829 if (!wm::GetModalTransient(local_window)) { | 843 if (!GetModalTransient(local_window)) { |
830 TabStrip* tab_strip = GetTabStripForWindow(local_window); | 844 TabStrip* tab_strip = GetTabStripForWindow(local_window); |
831 if (tab_strip && DoesTabStripContain(tab_strip, point_in_screen)) | 845 if (tab_strip && DoesTabStripContain(tab_strip, point_in_screen)) |
832 return tab_strip; | 846 return tab_strip; |
833 } | 847 } |
834 | 848 |
835 return is_dragging_window_ ? attached_tabstrip_ : NULL; | 849 return is_dragging_window_ ? attached_tabstrip_ : NULL; |
836 } | 850 } |
837 | 851 |
838 TabStrip* TabDragController::GetTabStripForWindow(gfx::NativeWindow window) { | 852 TabStrip* TabDragController::GetTabStripForWindow(gfx::NativeWindow window) { |
839 if (!window) | 853 if (!window) |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 DCHECK(active_); | 1344 DCHECK(active_); |
1331 active_ = false; | 1345 active_ = false; |
1332 | 1346 |
1333 bring_to_front_timer_.Stop(); | 1347 bring_to_front_timer_.Stop(); |
1334 move_stacked_timer_.Stop(); | 1348 move_stacked_timer_.Stop(); |
1335 | 1349 |
1336 if (is_dragging_window_) { | 1350 if (is_dragging_window_) { |
1337 waiting_for_run_loop_to_exit_ = true; | 1351 waiting_for_run_loop_to_exit_ = true; |
1338 | 1352 |
1339 if (type == NORMAL || (type == TAB_DESTROYED && drag_data_.size() > 1)) { | 1353 if (type == NORMAL || (type == TAB_DESTROYED && drag_data_.size() > 1)) { |
1340 SetWindowPositionManaged(GetAttachedBrowserWidget()->GetNativeView(), | 1354 SetWindowPositionManaged(GetAttachedBrowserWidget()->GetNativeWindow(), |
1341 true); | 1355 true); |
1342 } | 1356 } |
1343 | 1357 |
1344 // End the nested drag loop. | 1358 // End the nested drag loop. |
1345 GetAttachedBrowserWidget()->EndMoveLoop(); | 1359 GetAttachedBrowserWidget()->EndMoveLoop(); |
1346 } | 1360 } |
1347 | 1361 |
1348 if (type != TAB_DESTROYED) { | 1362 if (type != TAB_DESTROYED) { |
1349 // We only finish up the drag if we were actually dragging. If start_drag_ | 1363 // We only finish up the drag if we were actually dragging. If start_drag_ |
1350 // is false, the user just clicked and released and didn't move the mouse | 1364 // is false, the user just clicked and released and didn't move the mouse |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1546 views::View* view) const { | 1560 views::View* view) const { |
1547 gfx::Point view_topleft; | 1561 gfx::Point view_topleft; |
1548 views::View::ConvertPointToScreen(view, &view_topleft); | 1562 views::View::ConvertPointToScreen(view, &view_topleft); |
1549 gfx::Rect view_screen_bounds = view->GetLocalBounds(); | 1563 gfx::Rect view_screen_bounds = view->GetLocalBounds(); |
1550 view_screen_bounds.Offset(view_topleft.x(), view_topleft.y()); | 1564 view_screen_bounds.Offset(view_topleft.x(), view_topleft.y()); |
1551 return view_screen_bounds; | 1565 return view_screen_bounds; |
1552 } | 1566 } |
1553 | 1567 |
1554 void TabDragController::BringWindowUnderPointToFront( | 1568 void TabDragController::BringWindowUnderPointToFront( |
1555 const gfx::Point& point_in_screen) { | 1569 const gfx::Point& point_in_screen) { |
1556 aura::Window* window = GetLocalProcessWindow(point_in_screen, true); | 1570 gfx::NativeWindow window = GetLocalProcessWindow(point_in_screen, true); |
1557 | 1571 |
1558 // Only bring browser windows to front - only windows with a TabStrip can | 1572 // Only bring browser windows to front - only windows with a TabStrip can |
1559 // be tab drag targets. | 1573 // be tab drag targets. |
1560 if (!GetTabStripForWindow(window)) | 1574 if (!GetTabStripForWindow(window)) |
1561 return; | 1575 return; |
1562 | 1576 |
1563 if (window) { | 1577 if (window) { |
1564 views::Widget* widget_window = views::Widget::GetWidgetForNativeView( | 1578 views::Widget* widget_window = views::Widget::GetWidgetForNativeWindow( |
1565 window); | 1579 window); |
1566 if (!widget_window) | 1580 if (!widget_window) |
1567 return; | 1581 return; |
1568 | 1582 |
| 1583 #if defined(USE_ASH) |
1569 if (host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH) { | 1584 if (host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH) { |
1570 // TODO(varkha): The code below ensures that the phantom drag widget | 1585 // TODO(varkha): The code below ensures that the phantom drag widget |
1571 // is shown on top of browser windows. The code should be moved to ash/ | 1586 // is shown on top of browser windows. The code should be moved to ash/ |
1572 // and the phantom should be able to assert its top-most state on its own. | 1587 // and the phantom should be able to assert its top-most state on its own. |
1573 // One strategy would be for DragWindowController to | 1588 // One strategy would be for DragWindowController to |
1574 // be able to observe stacking changes to the phantom drag widget's | 1589 // be able to observe stacking changes to the phantom drag widget's |
1575 // siblings in order to keep it on top. One way is to implement a | 1590 // siblings in order to keep it on top. One way is to implement a |
1576 // notification that is sent to a window parent's observers when a | 1591 // notification that is sent to a window parent's observers when a |
1577 // stacking order is changed among the children of that same parent. | 1592 // stacking order is changed among the children of that same parent. |
1578 // Note that OnWindowStackingChanged is sent only to the child that is the | 1593 // Note that OnWindowStackingChanged is sent only to the child that is the |
(...skipping 11 matching lines...) Expand all Loading... |
1590 if (*it == browser_window) | 1605 if (*it == browser_window) |
1591 return; | 1606 return; |
1592 if ((*it)->type() != ui::wm::WINDOW_TYPE_POPUP) { | 1607 if ((*it)->type() != ui::wm::WINDOW_TYPE_POPUP) { |
1593 widget_window->StackAbove(*it); | 1608 widget_window->StackAbove(*it); |
1594 break; | 1609 break; |
1595 } | 1610 } |
1596 } | 1611 } |
1597 } else { | 1612 } else { |
1598 widget_window->StackAtTop(); | 1613 widget_window->StackAtTop(); |
1599 } | 1614 } |
| 1615 #else |
| 1616 widget_window->StackAtTop(); |
| 1617 #endif |
1600 | 1618 |
1601 // The previous call made the window appear on top of the dragged window, | 1619 // The previous call made the window appear on top of the dragged window, |
1602 // move the dragged window to the front. | 1620 // move the dragged window to the front. |
1603 if (is_dragging_window_) | 1621 if (is_dragging_window_) |
1604 attached_tabstrip_->GetWidget()->StackAtTop(); | 1622 attached_tabstrip_->GetWidget()->StackAtTop(); |
1605 } | 1623 } |
1606 } | 1624 } |
1607 | 1625 |
1608 TabStripModel* TabDragController::GetModel( | 1626 TabStripModel* TabDragController::GetModel( |
1609 TabStrip* tabstrip) const { | 1627 TabStrip* tabstrip) const { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1726 is_dragging_new_browser_ = true; | 1744 is_dragging_new_browser_ = true; |
1727 SetWindowPositionManaged(browser->window()->GetNativeWindow(), false); | 1745 SetWindowPositionManaged(browser->window()->GetNativeWindow(), false); |
1728 // If the window is created maximized then the bounds we supplied are ignored. | 1746 // If the window is created maximized then the bounds we supplied are ignored. |
1729 // We need to reset them again so they are honored. | 1747 // We need to reset them again so they are honored. |
1730 browser->window()->SetBounds(new_bounds); | 1748 browser->window()->SetBounds(new_bounds); |
1731 | 1749 |
1732 return browser; | 1750 return browser; |
1733 } | 1751 } |
1734 | 1752 |
1735 gfx::Point TabDragController::GetCursorScreenPoint() { | 1753 gfx::Point TabDragController::GetCursorScreenPoint() { |
| 1754 #if defined(USE_ASH) |
1736 if (host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH && | 1755 if (host_desktop_type_ == chrome::HOST_DESKTOP_TYPE_ASH && |
1737 event_source_ == EVENT_SOURCE_TOUCH && | 1756 event_source_ == EVENT_SOURCE_TOUCH && |
1738 aura::Env::GetInstance()->is_touch_down()) { | 1757 aura::Env::GetInstance()->is_touch_down()) { |
1739 views::Widget* widget = GetAttachedBrowserWidget(); | 1758 views::Widget* widget = GetAttachedBrowserWidget(); |
1740 DCHECK(widget); | 1759 DCHECK(widget); |
1741 aura::Window* widget_window = widget->GetNativeWindow(); | 1760 aura::Window* widget_window = widget->GetNativeWindow(); |
1742 DCHECK(widget_window->GetRootWindow()); | 1761 DCHECK(widget_window->GetRootWindow()); |
1743 gfx::PointF touch_point_f; | 1762 gfx::PointF touch_point_f; |
1744 bool got_touch_point = ui::GestureRecognizer::Get()-> | 1763 bool got_touch_point = ui::GestureRecognizer::Get()-> |
1745 GetLastTouchPointForTarget(widget_window, &touch_point_f); | 1764 GetLastTouchPointForTarget(widget_window, &touch_point_f); |
1746 // TODO(tdresser): Switch to using gfx::PointF. See crbug.com/337824. | 1765 // TODO(tdresser): Switch to using gfx::PointF. See crbug.com/337824. |
1747 gfx::Point touch_point = gfx::ToFlooredPoint(touch_point_f); | 1766 gfx::Point touch_point = gfx::ToFlooredPoint(touch_point_f); |
1748 DCHECK(got_touch_point); | 1767 DCHECK(got_touch_point); |
1749 wm::ConvertPointToScreen(widget_window->GetRootWindow(), &touch_point); | 1768 wm::ConvertPointToScreen(widget_window->GetRootWindow(), &touch_point); |
1750 return touch_point; | 1769 return touch_point; |
1751 } | 1770 } |
| 1771 #endif |
1752 | 1772 |
1753 return screen_->GetCursorScreenPoint(); | 1773 return screen_->GetCursorScreenPoint(); |
1754 } | 1774 } |
1755 | 1775 |
1756 gfx::Vector2d TabDragController::GetWindowOffset( | 1776 gfx::Vector2d TabDragController::GetWindowOffset( |
1757 const gfx::Point& point_in_screen) { | 1777 const gfx::Point& point_in_screen) { |
1758 TabStrip* owning_tabstrip = attached_tabstrip_ ? | 1778 TabStrip* owning_tabstrip = attached_tabstrip_ ? |
1759 attached_tabstrip_ : source_tabstrip_; | 1779 attached_tabstrip_ : source_tabstrip_; |
1760 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); | 1780 views::View* toplevel_view = owning_tabstrip->GetWidget()->GetContentsView(); |
1761 | 1781 |
1762 gfx::Point point = point_in_screen; | 1782 gfx::Point point = point_in_screen; |
1763 views::View::ConvertPointFromScreen(toplevel_view, &point); | 1783 views::View::ConvertPointFromScreen(toplevel_view, &point); |
1764 return point.OffsetFromOrigin(); | 1784 return point.OffsetFromOrigin(); |
1765 } | 1785 } |
1766 | 1786 |
1767 gfx::NativeWindow TabDragController::GetLocalProcessWindow( | 1787 gfx::NativeWindow TabDragController::GetLocalProcessWindow( |
1768 const gfx::Point& screen_point, | 1788 const gfx::Point& screen_point, |
1769 bool exclude_dragged_view) { | 1789 bool exclude_dragged_view) { |
1770 std::set<aura::Window*> exclude; | 1790 std::set<gfx::NativeWindow> exclude; |
1771 if (exclude_dragged_view) { | 1791 if (exclude_dragged_view) { |
1772 aura::Window* dragged_window = | 1792 gfx::NativeWindow dragged_window = |
1773 attached_tabstrip_->GetWidget()->GetNativeView(); | 1793 attached_tabstrip_->GetWidget()->GetNativeWindow(); |
1774 if (dragged_window) | 1794 if (dragged_window) |
1775 exclude.insert(dragged_window); | 1795 exclude.insert(dragged_window); |
1776 } | 1796 } |
1777 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 1797 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
1778 // Exclude windows which are pending deletion via Browser::TabStripEmpty(). | 1798 // Exclude windows which are pending deletion via Browser::TabStripEmpty(). |
1779 // These windows can be returned in the Linux Aura port because the browser | 1799 // These windows can be returned in the Linux Aura port because the browser |
1780 // window which was used for dragging is not hidden once all of its tabs are | 1800 // window which was used for dragging is not hidden once all of its tabs are |
1781 // attached to another browser window in DragBrowserToNewTabStrip(). | 1801 // attached to another browser window in DragBrowserToNewTabStrip(). |
1782 // TODO(pkotwicz): Fix this properly (crbug.com/358482) | 1802 // TODO(pkotwicz): Fix this properly (crbug.com/358482) |
1783 BrowserList* browser_list = BrowserList::GetInstance( | 1803 BrowserList* browser_list = BrowserList::GetInstance( |
1784 chrome::HOST_DESKTOP_TYPE_NATIVE); | 1804 chrome::HOST_DESKTOP_TYPE_NATIVE); |
1785 for (BrowserList::const_iterator it = browser_list->begin(); | 1805 for (BrowserList::const_iterator it = browser_list->begin(); |
1786 it != browser_list->end(); ++it) { | 1806 it != browser_list->end(); ++it) { |
1787 if ((*it)->tab_strip_model()->empty()) | 1807 if ((*it)->tab_strip_model()->empty()) |
1788 exclude.insert((*it)->window()->GetNativeWindow()); | 1808 exclude.insert((*it)->window()->GetNativeWindow()); |
1789 } | 1809 } |
1790 #endif | 1810 #endif |
1791 return GetLocalProcessWindowAtPoint(host_desktop_type_, | 1811 return GetLocalProcessWindowAtPoint(host_desktop_type_, |
1792 screen_point, | 1812 screen_point, |
1793 exclude); | 1813 exclude); |
1794 | 1814 |
1795 } | 1815 } |
OLD | NEW |