| 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/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 return source_tab_drag_data()->contents; | 450 return source_tab_drag_data()->contents; |
| 451 } | 451 } |
| 452 | 452 |
| 453 // Returns the Widget of the currently attached TabStrip's BrowserView. | 453 // Returns the Widget of the currently attached TabStrip's BrowserView. |
| 454 views::Widget* GetAttachedBrowserWidget(); | 454 views::Widget* GetAttachedBrowserWidget(); |
| 455 | 455 |
| 456 // Returns true if the tabs were originality one after the other in | 456 // Returns true if the tabs were originality one after the other in |
| 457 // |source_tabstrip_|. | 457 // |source_tabstrip_|. |
| 458 bool AreTabsConsecutive(); | 458 bool AreTabsConsecutive(); |
| 459 | 459 |
| 460 // Calculates and returns new bounds for the dragged browser window. |
| 461 // Takes into consideration current and restore bounds of |source| tab strip |
| 462 // preventing the dragged size from being too small. Positions the new bounds |
| 463 // such that the tab that was dragged remains under the |point_in_screen|. |
| 464 // Offsets |drag_bounds| if necessary when dragging to the right from the |
| 465 // source browser. |
| 466 gfx::Rect CalculateDraggedBrowserBounds(TabStrip* source, |
| 467 const gfx::Point& point_in_screen, |
| 468 std::vector<gfx::Rect>* drag_bounds); |
| 469 |
| 470 // Calculates scaled |drag_bounds| for dragged tabs and sets the tabs bounds. |
| 471 // Layout of the tabstrip is performed and a new tabstrip width calculated. |
| 472 // When |last_tabstrip_width| is larger than the new tabstrip width the tabs |
| 473 // in attached tabstrip are scaled and the attached browser is positioned such |
| 474 // that the tab that was dragged remains under the |point_in_screen|. |
| 475 void AdjustBrowserAndTabBoundsForDrag(int last_tabstrip_width, |
| 476 const gfx::Point& point_in_screen, |
| 477 std::vector<gfx::Rect>* drag_bounds); |
| 478 |
| 460 // Creates and returns a new Browser to handle the drag. | 479 // Creates and returns a new Browser to handle the drag. |
| 461 Browser* CreateBrowserForDrag(TabStrip* source, | 480 Browser* CreateBrowserForDrag(TabStrip* source, |
| 462 const gfx::Point& point_in_screen, | 481 const gfx::Point& point_in_screen, |
| 463 gfx::Vector2d* drag_offset, | 482 gfx::Vector2d* drag_offset, |
| 464 std::vector<gfx::Rect>* drag_bounds); | 483 std::vector<gfx::Rect>* drag_bounds); |
| 465 | 484 |
| 466 // Returns the TabStripModel for the specified tabstrip. | 485 // Returns the TabStripModel for the specified tabstrip. |
| 467 TabStripModel* GetModel(TabStrip* tabstrip) const; | 486 TabStripModel* GetModel(TabStrip* tabstrip) const; |
| 468 | 487 |
| 469 // Returns the location of the cursor. This is either the location of the | 488 // Returns the location of the cursor. This is either the location of the |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 // See comment around use for more details. | 655 // See comment around use for more details. |
| 637 int attach_x_; | 656 int attach_x_; |
| 638 int attach_index_; | 657 int attach_index_; |
| 639 | 658 |
| 640 base::WeakPtrFactory<TabDragController> weak_factory_; | 659 base::WeakPtrFactory<TabDragController> weak_factory_; |
| 641 | 660 |
| 642 DISALLOW_COPY_AND_ASSIGN(TabDragController); | 661 DISALLOW_COPY_AND_ASSIGN(TabDragController); |
| 643 }; | 662 }; |
| 644 | 663 |
| 645 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ | 664 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ |
| OLD | NEW |