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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 // runs a nested move loop. | 323 // runs a nested move loop. |
324 void DetachIntoNewBrowserAndRunMoveLoop(const gfx::Point& point_in_screen); | 324 void DetachIntoNewBrowserAndRunMoveLoop(const gfx::Point& point_in_screen); |
325 | 325 |
326 // Runs a nested message loop that handles moving the current | 326 // Runs a nested message loop that handles moving the current |
327 // Browser. |drag_offset| is the offset from the window origin and is used in | 327 // Browser. |drag_offset| is the offset from the window origin and is used in |
328 // calculating the location of the window offset from the cursor while | 328 // calculating the location of the window offset from the cursor while |
329 // dragging. | 329 // dragging. |
330 void RunMoveLoop(const gfx::Vector2d& drag_offset); | 330 void RunMoveLoop(const gfx::Vector2d& drag_offset); |
331 | 331 |
332 // Determines the index to insert tabs at. |dragged_bounds| is the bounds of | 332 // Determines the index to insert tabs at. |dragged_bounds| is the bounds of |
333 // the tabs being dragged, |start| the index of the tab to start looking from | 333 // the tabs being dragged, |start| the index of the tab to start looking from. |
334 // and |delta| the amount to increment (1 or -1). | 334 // The search proceeds to the end of the strip. |
335 int GetInsertionIndexFrom(const gfx::Rect& dragged_bounds, | 335 int GetInsertionIndexFrom(const gfx::Rect& dragged_bounds, int start) const; |
336 int start, | 336 |
337 int delta) const; | 337 // Like GetInsertionIndexFrom(), but searches backwards from |start| to the |
| 338 // beginning of the strip. |
| 339 int GetInsertionIndexFromReversed(const gfx::Rect& dragged_bounds, |
| 340 int start) const; |
338 | 341 |
339 // Returns the index where the dragged WebContents should be inserted into | 342 // Returns the index where the dragged WebContents should be inserted into |
340 // |attached_tabstrip_| given the DraggedTabView's bounds |dragged_bounds| in | 343 // |attached_tabstrip_| given the DraggedTabView's bounds |dragged_bounds| in |
341 // coordinates relative to |attached_tabstrip_| and has had the mirroring | 344 // coordinates relative to |attached_tabstrip_| and has had the mirroring |
342 // transformation applied. | 345 // transformation applied. |
343 // NOTE: this is invoked from Attach() before the tabs have been inserted. | 346 // NOTE: this is invoked from Attach() before the tabs have been inserted. |
344 int GetInsertionIndexForDraggedBounds(const gfx::Rect& dragged_bounds) const; | 347 int GetInsertionIndexForDraggedBounds(const gfx::Rect& dragged_bounds) const; |
345 | 348 |
346 // Returns true if |dragged_bounds| is close enough to the next stacked tab | 349 // Returns true if |dragged_bounds| is close enough to the next stacked tab |
347 // so that the active tab should be dragged there. | 350 // so that the active tab should be dragged there. |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 int attach_index_; | 637 int attach_index_; |
635 | 638 |
636 scoped_ptr<ui::EventHandler> escape_tracker_; | 639 scoped_ptr<ui::EventHandler> escape_tracker_; |
637 | 640 |
638 base::WeakPtrFactory<TabDragController> weak_factory_; | 641 base::WeakPtrFactory<TabDragController> weak_factory_; |
639 | 642 |
640 DISALLOW_COPY_AND_ASSIGN(TabDragController); | 643 DISALLOW_COPY_AND_ASSIGN(TabDragController); |
641 }; | 644 }; |
642 | 645 |
643 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ | 646 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ |
OLD | NEW |