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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 // Attach the dragged Tab to the specified TabStrip. | 313 // Attach the dragged Tab to the specified TabStrip. |
314 void Attach(TabStrip* attached_tabstrip, const gfx::Point& point_in_screen); | 314 void Attach(TabStrip* attached_tabstrip, const gfx::Point& point_in_screen); |
315 | 315 |
316 // Detach the dragged Tab from the current TabStrip. | 316 // Detach the dragged Tab from the current TabStrip. |
317 void Detach(ReleaseCapture release_capture); | 317 void Detach(ReleaseCapture release_capture); |
318 | 318 |
319 // Detaches the tabs being dragged, creates a new Browser to contain them and | 319 // Detaches the tabs being dragged, creates a new Browser to contain them and |
320 // runs a nested move loop. | 320 // runs a nested move loop. |
321 void DetachIntoNewBrowserAndRunMoveLoop(const gfx::Point& point_in_screen); | 321 void DetachIntoNewBrowserAndRunMoveLoop(const gfx::Point& point_in_screen); |
322 | 322 |
323 // Runs a nested message loop that handles moving the current Browser. | 323 // Runs a nested message loop that handles moving the current |
324 void RunMoveLoop(); | 324 // Browser. |drag_offset| is the offset from the window origin and is used in |
| 325 // calculating the location of the window offset from the cursor while |
| 326 // dragging. |
| 327 void RunMoveLoop(const gfx::Point& drag_offset); |
325 | 328 |
326 // Determines the index to insert tabs at. |dragged_bounds| is the bounds of | 329 // Determines the index to insert tabs at. |dragged_bounds| is the bounds of |
327 // the tabs being dragged, |start| the index of the tab to start looking from | 330 // the tabs being dragged, |start| the index of the tab to start looking from |
328 // and |delta| the amount to increment (1 or -1). | 331 // and |delta| the amount to increment (1 or -1). |
329 int GetInsertionIndexFrom(const gfx::Rect& dragged_bounds, | 332 int GetInsertionIndexFrom(const gfx::Rect& dragged_bounds, |
330 int start, | 333 int start, |
331 int delta) const; | 334 int delta) const; |
332 | 335 |
333 // Returns the index where the dragged WebContents should be inserted into | 336 // Returns the index where the dragged WebContents should be inserted into |
334 // |attached_tabstrip_| given the DraggedTabView's bounds |dragged_bounds| in | 337 // |attached_tabstrip_| given the DraggedTabView's bounds |dragged_bounds| in |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 // Returns the Widget of the currently attached TabStrip's BrowserView. | 424 // Returns the Widget of the currently attached TabStrip's BrowserView. |
422 views::Widget* GetAttachedBrowserWidget(); | 425 views::Widget* GetAttachedBrowserWidget(); |
423 | 426 |
424 // Returns true if the tabs were originality one after the other in | 427 // Returns true if the tabs were originality one after the other in |
425 // |source_tabstrip_|. | 428 // |source_tabstrip_|. |
426 bool AreTabsConsecutive(); | 429 bool AreTabsConsecutive(); |
427 | 430 |
428 // Creates and returns a new Browser to handle the drag. | 431 // Creates and returns a new Browser to handle the drag. |
429 Browser* CreateBrowserForDrag(TabStrip* source, | 432 Browser* CreateBrowserForDrag(TabStrip* source, |
430 const gfx::Point& point_in_screen, | 433 const gfx::Point& point_in_screen, |
| 434 gfx::Point* drag_offset, |
431 std::vector<gfx::Rect>* drag_bounds); | 435 std::vector<gfx::Rect>* drag_bounds); |
432 | 436 |
433 // Returns the TabStripModel for the specified tabstrip. | 437 // Returns the TabStripModel for the specified tabstrip. |
434 TabStripModel* GetModel(TabStrip* tabstrip) const; | 438 TabStripModel* GetModel(TabStrip* tabstrip) const; |
435 | 439 |
436 // Returns the location of the cursor. This is either the location of the | 440 // Returns the location of the cursor. This is either the location of the |
437 // mouse or the location of the current touch point. | 441 // mouse or the location of the current touch point. |
438 gfx::Point GetCursorScreenPoint(); | 442 gfx::Point GetCursorScreenPoint(); |
439 | 443 |
| 444 // Returns the offset from the top left corner of the window to |
| 445 // |point_in_screen|. |
| 446 gfx::Point GetWindowOffset(const gfx::Point& point_in_screen); |
| 447 |
440 // Returns true if moving the mouse only changes the visible tabs. | 448 // Returns true if moving the mouse only changes the visible tabs. |
441 bool move_only() const { | 449 bool move_only() const { |
442 return (move_behavior_ == MOVE_VISIBILE_TABS) != 0; | 450 return (move_behavior_ == MOVE_VISIBILE_TABS) != 0; |
443 } | 451 } |
444 | 452 |
445 // If true Detaching creates a new browser and enters a nested message loop. | 453 // If true Detaching creates a new browser and enters a nested message loop. |
446 const bool detach_into_browser_; | 454 const bool detach_into_browser_; |
447 | 455 |
448 // Handles registering for notifications. | 456 // Handles registering for notifications. |
449 content::NotificationRegistrar registrar_; | 457 content::NotificationRegistrar registrar_; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 // Non-null for the duration of RunMoveLoop. | 579 // Non-null for the duration of RunMoveLoop. |
572 views::Widget* move_loop_widget_; | 580 views::Widget* move_loop_widget_; |
573 | 581 |
574 // If non-null set to true from destructor. | 582 // If non-null set to true from destructor. |
575 bool* destroyed_; | 583 bool* destroyed_; |
576 | 584 |
577 DISALLOW_COPY_AND_ASSIGN(TabDragController); | 585 DISALLOW_COPY_AND_ASSIGN(TabDragController); |
578 }; | 586 }; |
579 | 587 |
580 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ | 588 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ |
OLD | NEW |