OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_VIEWS_TABS_TAB_OVERVIEW_GRID_H_ | 5 #ifndef CHROME_BROWSER_VIEWS_TABS_TAB_OVERVIEW_GRID_H_ |
6 #define CHROME_BROWSER_VIEWS_TABS_TAB_OVERVIEW_GRID_H_ | 6 #define CHROME_BROWSER_VIEWS_TABS_TAB_OVERVIEW_GRID_H_ |
7 | 7 |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "chrome/browser/views/tabs/grid.h" | 9 #include "chrome/browser/views/tabs/grid.h" |
10 | 10 |
11 class TabOverviewCell; | 11 class TabOverviewCell; |
12 class TabOverviewController; | 12 class TabOverviewController; |
13 class TabOverviewDragController; | 13 class TabOverviewDragController; |
14 | 14 |
15 // TabOverviewGrid is used to provide a grid view of the contents of a tab | 15 // TabOverviewGrid is used to provide a grid view of the contents of a tab |
16 // strip model. Each cell of the grid is a TabOverviewCell. TabOverviewGrids | 16 // strip model. Each cell of the grid is a TabOverviewCell. TabOverviewGrids |
17 // primary responsibility is to forward events to TabOverviewDragController. | 17 // primary responsibility is to forward events to TabOverviewDragController. |
18 class TabOverviewGrid : public Grid { | 18 class TabOverviewGrid : public Grid { |
19 public: | 19 public: |
20 explicit TabOverviewGrid(TabOverviewController* controller); | 20 explicit TabOverviewGrid(TabOverviewController* controller); |
21 virtual ~TabOverviewGrid(); | 21 virtual ~TabOverviewGrid(); |
22 | 22 |
23 // Returns true if a drag is underway and the drag is in the process of | 23 // Returns true if a drag is underway and the drag is in the process of |
24 // modifying the tab strip model. | 24 // modifying the tab strip model. |
25 bool modifying_model() const; | 25 bool modifying_model() const; |
26 | 26 |
27 // Returns the TabOverviewCell at the specified index. | 27 // Returns the TabOverviewCell at the specified index. |
28 TabOverviewCell* GetTabOverviewCellAt(int index); | 28 TabOverviewCell* GetTabOverviewCellAt(int index); |
29 | 29 |
| 30 // Returns the TabOverviewDragController. This is NULL if a drag is not |
| 31 // underway. |
| 32 TabOverviewDragController* drag_controller() const; |
| 33 |
30 // Cancels the drag. Does nothing if a drag is not underway. | 34 // Cancels the drag. Does nothing if a drag is not underway. |
31 void CancelDrag(); | 35 void CancelDrag(); |
32 | 36 |
33 // If a drag is under way, this invokes Drag on the DragController with the | 37 // If a drag is under way, this invokes Drag on the DragController with the |
34 // current position of the mouse. | 38 // current position of the mouse. |
35 void UpdateDragController(); | 39 void UpdateDragController(); |
36 | 40 |
37 // View overrides. | 41 // View overrides. |
38 virtual bool OnMousePressed(const views::MouseEvent& event); | 42 virtual bool OnMousePressed(const views::MouseEvent& event); |
39 virtual bool OnMouseDragged(const views::MouseEvent& event); | 43 virtual bool OnMouseDragged(const views::MouseEvent& event); |
40 virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); | 44 virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); |
41 | 45 |
42 // AnimationDelegate overrides. | 46 // AnimationDelegate overrides. |
43 virtual void AnimationEnded(const Animation* animation); | 47 virtual void AnimationEnded(const Animation* animation); |
44 virtual void AnimationProgressed(const Animation* animation); | 48 virtual void AnimationProgressed(const Animation* animation); |
45 virtual void AnimationCanceled(const Animation* animation); | 49 virtual void AnimationCanceled(const Animation* animation); |
46 | 50 |
47 private: | 51 private: |
48 TabOverviewController* controller_; | 52 TabOverviewController* controller_; |
49 | 53 |
50 scoped_ptr<TabOverviewDragController> drag_controller_; | 54 scoped_ptr<TabOverviewDragController> drag_controller_; |
51 | 55 |
52 DISALLOW_COPY_AND_ASSIGN(TabOverviewGrid); | 56 DISALLOW_COPY_AND_ASSIGN(TabOverviewGrid); |
53 }; | 57 }; |
54 | 58 |
55 #endif // CHROME_BROWSER_VIEWS_TABS_TAB_OVERVIEW_GRID_H_ | 59 #endif // CHROME_BROWSER_VIEWS_TABS_TAB_OVERVIEW_GRID_H_ |
OLD | NEW |