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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // in response to dragged tabs. | 47 // in response to dragged tabs. |
48 // | 48 // |
49 /////////////////////////////////////////////////////////////////////////////// | 49 /////////////////////////////////////////////////////////////////////////////// |
50 class TabStrip : public views::View, | 50 class TabStrip : public views::View, |
51 public views::ButtonListener, | 51 public views::ButtonListener, |
52 public views::MouseWatcherListener, | 52 public views::MouseWatcherListener, |
53 public TabController { | 53 public TabController { |
54 public: | 54 public: |
55 static const char kViewClassName[]; | 55 static const char kViewClassName[]; |
56 | 56 |
57 explicit TabStrip(TabStripController* controller); | 57 TabStrip(TabStripController* controller, |
| 58 bool instant_extended_api_enabled); |
58 virtual ~TabStrip(); | 59 virtual ~TabStrip(); |
59 | 60 |
60 // Sets the layout type. If |adjust_layout| is true the layout type changes | 61 // Sets the layout type. If |adjust_layout| is true the layout type changes |
61 // based on whether the user uses a mouse or touch device with the tabstrip. | 62 // based on whether the user uses a mouse or touch device with the tabstrip. |
62 // If |adjust_layout| is false the layout is fixed to |layout_type|. | 63 // If |adjust_layout| is false the layout is fixed to |layout_type|. |
63 void SetLayoutType(TabStripLayoutType layout_type, bool adjust_layout); | 64 void SetLayoutType(TabStripLayoutType layout_type, bool adjust_layout); |
64 TabStripLayoutType layout_type() const { return layout_type_; } | 65 TabStripLayoutType layout_type() const { return layout_type_; } |
65 | 66 |
66 // Returns the bounds of the new tab button. | 67 // Returns the bounds of the new tab button. |
67 gfx::Rect GetNewTabButtonBounds(); | 68 gfx::Rect GetNewTabButtonBounds(); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 const TabStripSelectionModel& original_selection) OVERRIDE; | 180 const TabStripSelectionModel& original_selection) OVERRIDE; |
180 virtual void ContinueDrag(views::View* view, | 181 virtual void ContinueDrag(views::View* view, |
181 const gfx::Point& location) OVERRIDE; | 182 const gfx::Point& location) OVERRIDE; |
182 virtual bool EndDrag(bool canceled) OVERRIDE; | 183 virtual bool EndDrag(bool canceled) OVERRIDE; |
183 virtual BaseTab* GetTabAt(BaseTab* tab, | 184 virtual BaseTab* GetTabAt(BaseTab* tab, |
184 const gfx::Point& tab_in_tab_coordinates) OVERRIDE; | 185 const gfx::Point& tab_in_tab_coordinates) OVERRIDE; |
185 virtual void ClickActiveTab(const BaseTab* tab) const OVERRIDE; | 186 virtual void ClickActiveTab(const BaseTab* tab) const OVERRIDE; |
186 virtual void OnMouseEventInTab(views::View* source, | 187 virtual void OnMouseEventInTab(views::View* source, |
187 const views::MouseEvent& event) OVERRIDE; | 188 const views::MouseEvent& event) OVERRIDE; |
188 virtual bool ShouldPaintTab(const BaseTab* tab, gfx::Rect* clip) OVERRIDE; | 189 virtual bool ShouldPaintTab(const BaseTab* tab, gfx::Rect* clip) OVERRIDE; |
| 190 virtual bool IsInstantExtendedAPIEnabled() OVERRIDE; |
189 | 191 |
190 // MouseWatcherListener overrides: | 192 // MouseWatcherListener overrides: |
191 virtual void MouseMovedOutOfHost() OVERRIDE; | 193 virtual void MouseMovedOutOfHost() OVERRIDE; |
192 | 194 |
193 // views::View overrides: | 195 // views::View overrides: |
194 virtual void Layout() OVERRIDE; | 196 virtual void Layout() OVERRIDE; |
195 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; | 197 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; |
196 virtual std::string GetClassName() const OVERRIDE; | 198 virtual std::string GetClassName() const OVERRIDE; |
197 virtual gfx::Size GetPreferredSize() OVERRIDE; | 199 virtual gfx::Size GetPreferredSize() OVERRIDE; |
198 // NOTE: the drag and drop methods are invoked from FrameView. This is done | 200 // NOTE: the drag and drop methods are invoked from FrameView. This is done |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 // removal there exists a period of time where a tab is displayed but not in | 469 // removal there exists a period of time where a tab is displayed but not in |
468 // the model. When this occurs the tab is removed from |tabs_| and placed in | 470 // the model. When this occurs the tab is removed from |tabs_| and placed in |
469 // |tabs_closing_map_|. When the animation completes the tab is removed from | 471 // |tabs_closing_map_|. When the animation completes the tab is removed from |
470 // |tabs_closing_map_|. The painting code ensures both sets of tabs are | 472 // |tabs_closing_map_|. The painting code ensures both sets of tabs are |
471 // painted, and the event handling code ensures only tabs in |tabs_| are used. | 473 // painted, and the event handling code ensures only tabs in |tabs_| are used. |
472 views::ViewModel tabs_; | 474 views::ViewModel tabs_; |
473 TabsClosingMap tabs_closing_map_; | 475 TabsClosingMap tabs_closing_map_; |
474 | 476 |
475 scoped_ptr<TabStripController> controller_; | 477 scoped_ptr<TabStripController> controller_; |
476 | 478 |
| 479 const bool instant_extended_api_enabled_; |
| 480 |
477 // The "New Tab" button. | 481 // The "New Tab" button. |
478 NewTabButton* newtab_button_; | 482 NewTabButton* newtab_button_; |
479 | 483 |
480 // Ideal bounds of the new tab button. | 484 // Ideal bounds of the new tab button. |
481 gfx::Rect newtab_button_bounds_; | 485 gfx::Rect newtab_button_bounds_; |
482 | 486 |
483 // The current widths of various types of tabs. We save these so that, as | 487 // The current widths of various types of tabs. We save these so that, as |
484 // users close tabs while we're holding them at the same size, we can lay out | 488 // users close tabs while we're holding them at the same size, we can lay out |
485 // tabs exactly and eliminate the "pixel jitter" we'd get from just leaving | 489 // tabs exactly and eliminate the "pixel jitter" we'd get from just leaving |
486 // them all at their existing, rounded widths. | 490 // them all at their existing, rounded widths. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 // Time of the last mouse move event. | 540 // Time of the last mouse move event. |
537 base::TimeTicks last_mouse_move_time_; | 541 base::TimeTicks last_mouse_move_time_; |
538 | 542 |
539 // Number of mouse moves. | 543 // Number of mouse moves. |
540 int mouse_move_count_; | 544 int mouse_move_count_; |
541 | 545 |
542 DISALLOW_COPY_AND_ASSIGN(TabStrip); | 546 DISALLOW_COPY_AND_ASSIGN(TabStrip); |
543 }; | 547 }; |
544 | 548 |
545 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ | 549 #endif // CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_ |
OLD | NEW |