| 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 void Detach(ReleaseCapture release_capture); | 328 void Detach(ReleaseCapture release_capture); |
| 329 | 329 |
| 330 // Detaches the tabs being dragged, creates a new Browser to contain them and | 330 // Detaches the tabs being dragged, creates a new Browser to contain them and |
| 331 // runs a nested move loop. | 331 // runs a nested move loop. |
| 332 void DetachIntoNewBrowserAndRunMoveLoop(const gfx::Point& point_in_screen); | 332 void DetachIntoNewBrowserAndRunMoveLoop(const gfx::Point& point_in_screen); |
| 333 | 333 |
| 334 // Runs a nested message loop that handles moving the current | 334 // Runs a nested message loop that handles moving the current |
| 335 // Browser. |drag_offset| is the offset from the window origin and is used in | 335 // Browser. |drag_offset| is the offset from the window origin and is used in |
| 336 // calculating the location of the window offset from the cursor while | 336 // calculating the location of the window offset from the cursor while |
| 337 // dragging. | 337 // dragging. |
| 338 void RunMoveLoop(const gfx::Point& drag_offset); | 338 void RunMoveLoop(const gfx::Vector2d& drag_offset); |
| 339 | 339 |
| 340 // Determines the index to insert tabs at. |dragged_bounds| is the bounds of | 340 // Determines the index to insert tabs at. |dragged_bounds| is the bounds of |
| 341 // the tabs being dragged, |start| the index of the tab to start looking from | 341 // the tabs being dragged, |start| the index of the tab to start looking from |
| 342 // and |delta| the amount to increment (1 or -1). | 342 // and |delta| the amount to increment (1 or -1). |
| 343 int GetInsertionIndexFrom(const gfx::Rect& dragged_bounds, | 343 int GetInsertionIndexFrom(const gfx::Rect& dragged_bounds, |
| 344 int start, | 344 int start, |
| 345 int delta) const; | 345 int delta) const; |
| 346 | 346 |
| 347 // Returns the index where the dragged WebContents should be inserted into | 347 // Returns the index where the dragged WebContents should be inserted into |
| 348 // |attached_tabstrip_| given the DraggedTabView's bounds |dragged_bounds| in | 348 // |attached_tabstrip_| given the DraggedTabView's bounds |dragged_bounds| in |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 // Returns the Widget of the currently attached TabStrip's BrowserView. | 435 // Returns the Widget of the currently attached TabStrip's BrowserView. |
| 436 views::Widget* GetAttachedBrowserWidget(); | 436 views::Widget* GetAttachedBrowserWidget(); |
| 437 | 437 |
| 438 // Returns true if the tabs were originality one after the other in | 438 // Returns true if the tabs were originality one after the other in |
| 439 // |source_tabstrip_|. | 439 // |source_tabstrip_|. |
| 440 bool AreTabsConsecutive(); | 440 bool AreTabsConsecutive(); |
| 441 | 441 |
| 442 // Creates and returns a new Browser to handle the drag. | 442 // Creates and returns a new Browser to handle the drag. |
| 443 Browser* CreateBrowserForDrag(TabStrip* source, | 443 Browser* CreateBrowserForDrag(TabStrip* source, |
| 444 const gfx::Point& point_in_screen, | 444 const gfx::Point& point_in_screen, |
| 445 gfx::Point* drag_offset, | 445 gfx::Vector2d* drag_offset, |
| 446 std::vector<gfx::Rect>* drag_bounds); | 446 std::vector<gfx::Rect>* drag_bounds); |
| 447 | 447 |
| 448 // Returns the TabStripModel for the specified tabstrip. | 448 // Returns the TabStripModel for the specified tabstrip. |
| 449 TabStripModel* GetModel(TabStrip* tabstrip) const; | 449 TabStripModel* GetModel(TabStrip* tabstrip) const; |
| 450 | 450 |
| 451 // Returns the location of the cursor. This is either the location of the | 451 // Returns the location of the cursor. This is either the location of the |
| 452 // mouse or the location of the current touch point. | 452 // mouse or the location of the current touch point. |
| 453 gfx::Point GetCursorScreenPoint(); | 453 gfx::Point GetCursorScreenPoint(); |
| 454 | 454 |
| 455 // Returns the offset from the top left corner of the window to | 455 // Returns the offset from the top left corner of the window to |
| 456 // |point_in_screen|. | 456 // |point_in_screen|. |
| 457 gfx::Point GetWindowOffset(const gfx::Point& point_in_screen); | 457 gfx::Vector2d GetWindowOffset(const gfx::Point& point_in_screen); |
| 458 | 458 |
| 459 // Returns true if moving the mouse only changes the visible tabs. | 459 // Returns true if moving the mouse only changes the visible tabs. |
| 460 bool move_only() const { | 460 bool move_only() const { |
| 461 return (move_behavior_ == MOVE_VISIBILE_TABS) != 0; | 461 return (move_behavior_ == MOVE_VISIBILE_TABS) != 0; |
| 462 } | 462 } |
| 463 | 463 |
| 464 // If true Detaching creates a new browser and enters a nested message loop. | 464 // If true Detaching creates a new browser and enters a nested message loop. |
| 465 const bool detach_into_browser_; | 465 const bool detach_into_browser_; |
| 466 | 466 |
| 467 // Handles registering for notifications. | 467 // Handles registering for notifications. |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 // If non-null set to true from destructor. | 596 // If non-null set to true from destructor. |
| 597 bool* destroyed_; | 597 bool* destroyed_; |
| 598 | 598 |
| 599 // See description above getter. | 599 // See description above getter. |
| 600 bool is_mutating_; | 600 bool is_mutating_; |
| 601 | 601 |
| 602 DISALLOW_COPY_AND_ASSIGN(TabDragController); | 602 DISALLOW_COPY_AND_ASSIGN(TabDragController); |
| 603 }; | 603 }; |
| 604 | 604 |
| 605 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ | 605 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ |
| OLD | NEW |