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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 Browser. |
324 void RunMoveLoop(); | 324 void RunMoveLoop(const gfx::Point& drag_offset); |
sky
2012/08/16 20:11:20
Document drag_offset.
| |
325 | 325 |
326 // Determines the index to insert tabs at. |dragged_bounds| is the bounds of | 326 // 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 | 327 // the tabs being dragged, |start| the index of the tab to start looking from |
328 // and |delta| the amount to increment (1 or -1). | 328 // and |delta| the amount to increment (1 or -1). |
329 int GetInsertionIndexFrom(const gfx::Rect& dragged_bounds, | 329 int GetInsertionIndexFrom(const gfx::Rect& dragged_bounds, |
330 int start, | 330 int start, |
331 int delta) const; | 331 int delta) const; |
332 | 332 |
333 // Returns the index where the dragged WebContents should be inserted into | 333 // Returns the index where the dragged WebContents should be inserted into |
334 // |attached_tabstrip_| given the DraggedTabView's bounds |dragged_bounds| in | 334 // |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. | 421 // Returns the Widget of the currently attached TabStrip's BrowserView. |
422 views::Widget* GetAttachedBrowserWidget(); | 422 views::Widget* GetAttachedBrowserWidget(); |
423 | 423 |
424 // Returns true if the tabs were originality one after the other in | 424 // Returns true if the tabs were originality one after the other in |
425 // |source_tabstrip_|. | 425 // |source_tabstrip_|. |
426 bool AreTabsConsecutive(); | 426 bool AreTabsConsecutive(); |
427 | 427 |
428 // Creates and returns a new Browser to handle the drag. | 428 // Creates and returns a new Browser to handle the drag. |
429 Browser* CreateBrowserForDrag(TabStrip* source, | 429 Browser* CreateBrowserForDrag(TabStrip* source, |
430 const gfx::Point& point_in_screen, | 430 const gfx::Point& point_in_screen, |
431 gfx::Point* drag_offset, | |
431 std::vector<gfx::Rect>* drag_bounds); | 432 std::vector<gfx::Rect>* drag_bounds); |
432 | 433 |
433 // Returns the TabStripModel for the specified tabstrip. | 434 // Returns the TabStripModel for the specified tabstrip. |
434 TabStripModel* GetModel(TabStrip* tabstrip) const; | 435 TabStripModel* GetModel(TabStrip* tabstrip) const; |
435 | 436 |
436 // Returns the location of the cursor. This is either the location of the | 437 // Returns the location of the cursor. This is either the location of the |
437 // mouse or the location of the current touch point. | 438 // mouse or the location of the current touch point. |
438 gfx::Point GetCursorScreenPoint(); | 439 gfx::Point GetCursorScreenPoint(); |
439 | 440 |
441 // Returns the offset from the top left corner of the window to | |
442 // |point_in_screen|. | |
443 gfx::Point GetWindowOffset(const gfx::Point& point_in_screen); | |
444 | |
440 // Returns true if moving the mouse only changes the visible tabs. | 445 // Returns true if moving the mouse only changes the visible tabs. |
441 bool move_only() const { | 446 bool move_only() const { |
442 return (move_behavior_ == MOVE_VISIBILE_TABS) != 0; | 447 return (move_behavior_ == MOVE_VISIBILE_TABS) != 0; |
443 } | 448 } |
444 | 449 |
445 // If true Detaching creates a new browser and enters a nested message loop. | 450 // If true Detaching creates a new browser and enters a nested message loop. |
446 const bool detach_into_browser_; | 451 const bool detach_into_browser_; |
447 | 452 |
448 // Handles registering for notifications. | 453 // Handles registering for notifications. |
449 content::NotificationRegistrar registrar_; | 454 content::NotificationRegistrar registrar_; |
(...skipping 12 matching lines...) Expand all Loading... | |
462 // operation. This is used to calculate minimum elasticity before a | 467 // operation. This is used to calculate minimum elasticity before a |
463 // DraggedTabView is constructed. | 468 // DraggedTabView is constructed. |
464 gfx::Point start_point_in_screen_; | 469 gfx::Point start_point_in_screen_; |
465 | 470 |
466 // This is the offset of the mouse from the top left of the Tab where | 471 // This is the offset of the mouse from the top left of the Tab where |
467 // dragging begun. This is used to ensure that the dragged view is always | 472 // dragging begun. This is used to ensure that the dragged view is always |
468 // positioned at the correct location during the drag, and to ensure that the | 473 // positioned at the correct location during the drag, and to ensure that the |
469 // detached window is created at the right location. | 474 // detached window is created at the right location. |
470 gfx::Point mouse_offset_; | 475 gfx::Point mouse_offset_; |
471 | 476 |
477 gfx::Point window_mouse_offset_; | |
sky
2012/08/16 20:11:20
Add description.
Elliot Glaysher
2012/08/16 20:33:48
Removed stray mark.
| |
478 | |
472 // Offset of the mouse relative to the source tab. | 479 // Offset of the mouse relative to the source tab. |
473 int source_tab_offset_; | 480 int source_tab_offset_; |
474 | 481 |
475 // Ratio of the x-coordinate of the |source_tab_offset_| to the width of the | 482 // Ratio of the x-coordinate of the |source_tab_offset_| to the width of the |
476 // tab. Not used for vertical tabs. | 483 // tab. Not used for vertical tabs. |
477 float offset_to_width_ratio_; | 484 float offset_to_width_ratio_; |
478 | 485 |
479 // A hint to use when positioning new windows created by detaching Tabs. This | 486 // A hint to use when positioning new windows created by detaching Tabs. This |
480 // is the distance of the mouse from the top left of the dragged tab as if it | 487 // is the distance of the mouse from the top left of the dragged tab as if it |
481 // were the distance of the mouse from the top left of the first tab in the | 488 // were the distance of the mouse from the top left of the first tab in the |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
571 // Non-null for the duration of RunMoveLoop. | 578 // Non-null for the duration of RunMoveLoop. |
572 views::Widget* move_loop_widget_; | 579 views::Widget* move_loop_widget_; |
573 | 580 |
574 // If non-null set to true from destructor. | 581 // If non-null set to true from destructor. |
575 bool* destroyed_; | 582 bool* destroyed_; |
576 | 583 |
577 DISALLOW_COPY_AND_ASSIGN(TabDragController); | 584 DISALLOW_COPY_AND_ASSIGN(TabDragController); |
578 }; | 585 }; |
579 | 586 |
580 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ | 587 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_DRAG_CONTROLLER_H_ |
OLD | NEW |