| 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_STRIP_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 // There is a one-to-one mapping between each of the tabs in the | 562 // There is a one-to-one mapping between each of the tabs in the |
| 563 // TabStripController (TabStripModel) and |tabs_|. Because we animate tab | 563 // TabStripController (TabStripModel) and |tabs_|. Because we animate tab |
| 564 // removal there exists a period of time where a tab is displayed but not in | 564 // removal there exists a period of time where a tab is displayed but not in |
| 565 // the model. When this occurs the tab is removed from |tabs_| and placed in | 565 // the model. When this occurs the tab is removed from |tabs_| and placed in |
| 566 // |tabs_closing_map_|. When the animation completes the tab is removed from | 566 // |tabs_closing_map_|. When the animation completes the tab is removed from |
| 567 // |tabs_closing_map_|. The painting code ensures both sets of tabs are | 567 // |tabs_closing_map_|. The painting code ensures both sets of tabs are |
| 568 // painted, and the event handling code ensures only tabs in |tabs_| are used. | 568 // painted, and the event handling code ensures only tabs in |tabs_| are used. |
| 569 views::ViewModelT<Tab> tabs_; | 569 views::ViewModelT<Tab> tabs_; |
| 570 TabsClosingMap tabs_closing_map_; | 570 TabsClosingMap tabs_closing_map_; |
| 571 | 571 |
| 572 scoped_ptr<TabStripController> controller_; | 572 std::unique_ptr<TabStripController> controller_; |
| 573 | 573 |
| 574 // The "New Tab" button. | 574 // The "New Tab" button. |
| 575 NewTabButton* newtab_button_; | 575 NewTabButton* newtab_button_; |
| 576 | 576 |
| 577 // Ideal bounds of the new tab button. | 577 // Ideal bounds of the new tab button. |
| 578 gfx::Rect newtab_button_bounds_; | 578 gfx::Rect newtab_button_bounds_; |
| 579 | 579 |
| 580 // Returns the current widths of each type of tab. If the tabstrip width is | 580 // Returns the current widths of each type of tab. If the tabstrip width is |
| 581 // not evenly divisible into these widths, the initial tabs in the strip will | 581 // not evenly divisible into these widths, the initial tabs in the strip will |
| 582 // be 1 px larger. | 582 // be 1 px larger. |
| 583 int current_inactive_width_; | 583 int current_inactive_width_; |
| 584 int current_active_width_; | 584 int current_active_width_; |
| 585 | 585 |
| 586 // If this value is nonnegative, it is used as the width to lay out tabs | 586 // If this value is nonnegative, it is used as the width to lay out tabs |
| 587 // (instead of tab_area_width()). Most of the time this will be -1, but while | 587 // (instead of tab_area_width()). Most of the time this will be -1, but while |
| 588 // we're handling closing a tab via the mouse, we'll set this to the edge of | 588 // we're handling closing a tab via the mouse, we'll set this to the edge of |
| 589 // the last tab before closing, so that if we are closing the last tab and | 589 // the last tab before closing, so that if we are closing the last tab and |
| 590 // need to resize immediately, we'll resize only back to this width, thus | 590 // need to resize immediately, we'll resize only back to this width, thus |
| 591 // once again placing the last tab under the mouse cursor. | 591 // once again placing the last tab under the mouse cursor. |
| 592 int available_width_for_tabs_; | 592 int available_width_for_tabs_; |
| 593 | 593 |
| 594 // True if PrepareForCloseAt has been invoked. When true remove animations | 594 // True if PrepareForCloseAt has been invoked. When true remove animations |
| 595 // preserve current tab bounds. | 595 // preserve current tab bounds. |
| 596 bool in_tab_close_; | 596 bool in_tab_close_; |
| 597 | 597 |
| 598 // Valid for the lifetime of a drag over us. | 598 // Valid for the lifetime of a drag over us. |
| 599 scoped_ptr<DropInfo> drop_info_; | 599 std::unique_ptr<DropInfo> drop_info_; |
| 600 | 600 |
| 601 // To ensure all tabs pulse at the same time they share the same animation | 601 // To ensure all tabs pulse at the same time they share the same animation |
| 602 // container. This is that animation container. | 602 // container. This is that animation container. |
| 603 scoped_refptr<gfx::AnimationContainer> animation_container_; | 603 scoped_refptr<gfx::AnimationContainer> animation_container_; |
| 604 | 604 |
| 605 // MouseWatcher is used for two things: | 605 // MouseWatcher is used for two things: |
| 606 // . When a tab is closed to reset the layout. | 606 // . When a tab is closed to reset the layout. |
| 607 // . When a mouse is used and the layout dynamically adjusts and is currently | 607 // . When a mouse is used and the layout dynamically adjusts and is currently |
| 608 // stacked (|stacked_layout_| is true). | 608 // stacked (|stacked_layout_| is true). |
| 609 scoped_ptr<views::MouseWatcher> mouse_watcher_; | 609 std::unique_ptr<views::MouseWatcher> mouse_watcher_; |
| 610 | 610 |
| 611 // The controller for a drag initiated from a Tab. Valid for the lifetime of | 611 // The controller for a drag initiated from a Tab. Valid for the lifetime of |
| 612 // the drag session. | 612 // the drag session. |
| 613 scoped_ptr<TabDragController> drag_controller_; | 613 std::unique_ptr<TabDragController> drag_controller_; |
| 614 | 614 |
| 615 views::BoundsAnimator bounds_animator_; | 615 views::BoundsAnimator bounds_animator_; |
| 616 | 616 |
| 617 // Size we last layed out at. | 617 // Size we last layed out at. |
| 618 gfx::Size last_layout_size_; | 618 gfx::Size last_layout_size_; |
| 619 | 619 |
| 620 // See description above stacked_layout(). | 620 // See description above stacked_layout(). |
| 621 bool stacked_layout_; | 621 bool stacked_layout_; |
| 622 | 622 |
| 623 // Should the layout dynamically adjust? | 623 // Should the layout dynamically adjust? |
| 624 bool adjust_layout_; | 624 bool adjust_layout_; |
| 625 | 625 |
| 626 // Only used while in touch mode. | 626 // Only used while in touch mode. |
| 627 scoped_ptr<StackedTabStripLayout> touch_layout_; | 627 std::unique_ptr<StackedTabStripLayout> touch_layout_; |
| 628 | 628 |
| 629 // If true the |stacked_layout_| is set to false when the mouse exits the | 629 // If true the |stacked_layout_| is set to false when the mouse exits the |
| 630 // tabstrip (as determined using MouseWatcher). | 630 // tabstrip (as determined using MouseWatcher). |
| 631 bool reset_to_shrink_on_exit_; | 631 bool reset_to_shrink_on_exit_; |
| 632 | 632 |
| 633 // Location of the mouse at the time of the last move. | 633 // Location of the mouse at the time of the last move. |
| 634 gfx::Point last_mouse_move_location_; | 634 gfx::Point last_mouse_move_location_; |
| 635 | 635 |
| 636 // Time of the last mouse move event. | 636 // Time of the last mouse move event. |
| 637 base::TimeTicks last_mouse_move_time_; | 637 base::TimeTicks last_mouse_move_time_; |
| 638 | 638 |
| 639 // Number of mouse moves. | 639 // Number of mouse moves. |
| 640 int mouse_move_count_; | 640 int mouse_move_count_; |
| 641 | 641 |
| 642 // Timer used when a tab is closed and we need to relayout. Only used when a | 642 // Timer used when a tab is closed and we need to relayout. Only used when a |
| 643 // tab close comes from a touch device. | 643 // tab close comes from a touch device. |
| 644 base::OneShotTimer resize_layout_timer_; | 644 base::OneShotTimer resize_layout_timer_; |
| 645 | 645 |
| 646 // True if tabs are painted as rectangular light-bars. | 646 // True if tabs are painted as rectangular light-bars. |
| 647 bool immersive_style_; | 647 bool immersive_style_; |
| 648 | 648 |
| 649 // Our observers. | 649 // Our observers. |
| 650 typedef base::ObserverList<TabStripObserver> TabStripObservers; | 650 typedef base::ObserverList<TabStripObserver> TabStripObservers; |
| 651 TabStripObservers observers_; | 651 TabStripObservers observers_; |
| 652 | 652 |
| 653 DISALLOW_COPY_AND_ASSIGN(TabStrip); | 653 DISALLOW_COPY_AND_ASSIGN(TabStrip); |
| 654 }; | 654 }; |
| 655 | 655 |
| 656 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ | 656 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ |
| OLD | NEW |