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 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // Specifies what should happen when a drag motion exits the tab strip region | 176 // Specifies what should happen when a drag motion exits the tab strip region |
177 // in an attempt to detach a tab. | 177 // in an attempt to detach a tab. |
178 enum DetachBehavior { | 178 enum DetachBehavior { |
179 DETACHABLE, | 179 DETACHABLE, |
180 NOT_DETACHABLE | 180 NOT_DETACHABLE |
181 }; | 181 }; |
182 | 182 |
183 // Indicates what should happen after invoking DragBrowserToNewTabStrip(). | 183 // Indicates what should happen after invoking DragBrowserToNewTabStrip(). |
184 enum DragBrowserResultType { | 184 enum DragBrowserResultType { |
185 // The caller should return immediately. This return value is used if a | 185 // The caller should return immediately. This return value is used if a |
186 // nested message loop was created or we're in a nested message loop and | 186 // nested run loop was created or we're in a nested run loop and |
187 // need to exit it. | 187 // need to exit it. |
188 DRAG_BROWSER_RESULT_STOP, | 188 DRAG_BROWSER_RESULT_STOP, |
189 | 189 |
190 // The caller should continue. | 190 // The caller should continue. |
191 DRAG_BROWSER_RESULT_CONTINUE, | 191 DRAG_BROWSER_RESULT_CONTINUE, |
192 }; | 192 }; |
193 | 193 |
194 // Stores the date associated with a single tab that is being dragged. | 194 // Stores the date associated with a single tab that is being dragged. |
195 struct TabDragData { | 195 struct TabDragData { |
196 TabDragData(); | 196 TabDragData(); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 // Attach the dragged Tab to the specified TabStrip. | 296 // Attach the dragged Tab to the specified TabStrip. |
297 void Attach(TabStrip* attached_tabstrip, const gfx::Point& point_in_screen); | 297 void Attach(TabStrip* attached_tabstrip, const gfx::Point& point_in_screen); |
298 | 298 |
299 // Detach the dragged Tab from the current TabStrip. | 299 // Detach the dragged Tab from the current TabStrip. |
300 void Detach(ReleaseCapture release_capture); | 300 void Detach(ReleaseCapture release_capture); |
301 | 301 |
302 // Detaches the tabs being dragged, creates a new Browser to contain them and | 302 // Detaches the tabs being dragged, creates a new Browser to contain them and |
303 // runs a nested move loop. | 303 // runs a nested move loop. |
304 void DetachIntoNewBrowserAndRunMoveLoop(const gfx::Point& point_in_screen); | 304 void DetachIntoNewBrowserAndRunMoveLoop(const gfx::Point& point_in_screen); |
305 | 305 |
306 // Runs a nested message loop that handles moving the current | 306 // Runs a nested run loop that handles moving the current |
307 // Browser. |drag_offset| is the offset from the window origin and is used in | 307 // Browser. |drag_offset| is the offset from the window origin and is used in |
308 // calculating the location of the window offset from the cursor while | 308 // calculating the location of the window offset from the cursor while |
309 // dragging. | 309 // dragging. |
310 void RunMoveLoop(const gfx::Vector2d& drag_offset); | 310 void RunMoveLoop(const gfx::Vector2d& drag_offset); |
311 | 311 |
312 // Determines the index to insert tabs at. |dragged_bounds| is the bounds of | 312 // Determines the index to insert tabs at. |dragged_bounds| is the bounds of |
313 // the tabs being dragged, |start| the index of the tab to start looking from. | 313 // the tabs being dragged, |start| the index of the tab to start looking from. |
314 // The search proceeds to the end of the strip. | 314 // The search proceeds to the end of the strip. |
315 int GetInsertionIndexFrom(const gfx::Rect& dragged_bounds, int start) const; | 315 int GetInsertionIndexFrom(const gfx::Rect& dragged_bounds, int start) const; |
316 | 316 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 std::unique_ptr<ui::EventHandler> escape_tracker_; | 600 std::unique_ptr<ui::EventHandler> escape_tracker_; |
601 | 601 |
602 std::unique_ptr<WindowFinder> window_finder_; | 602 std::unique_ptr<WindowFinder> window_finder_; |
603 | 603 |
604 base::WeakPtrFactory<TabDragController> weak_factory_; | 604 base::WeakPtrFactory<TabDragController> weak_factory_; |
605 | 605 |
606 DISALLOW_COPY_AND_ASSIGN(TabDragController); | 606 DISALLOW_COPY_AND_ASSIGN(TabDragController); |
607 }; | 607 }; |
608 | 608 |
609 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ | 609 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ |
OLD | NEW |