OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_TABS_TAB_STRIP_MODEL_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_TABS_TAB_STRIP_MODEL_OBSERVER_H_ |
6 #define CHROME_BROWSER_TABS_TAB_STRIP_MODEL_OBSERVER_H_ | 6 #define CHROME_BROWSER_TABS_TAB_STRIP_MODEL_OBSERVER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 class TabContentsWrapper; | 9 class TabContentsWrapper; |
10 class TabStripModel; | 10 class TabStripModel; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // The specified TabContents at |index| is being detached, perhaps to be | 54 // The specified TabContents at |index| is being detached, perhaps to be |
55 // inserted in another TabStripModel. The implementer should take whatever | 55 // inserted in another TabStripModel. The implementer should take whatever |
56 // action is necessary to deal with the TabContents no longer being present. | 56 // action is necessary to deal with the TabContents no longer being present. |
57 virtual void TabDetachedAt(TabContentsWrapper* contents, int index); | 57 virtual void TabDetachedAt(TabContentsWrapper* contents, int index); |
58 | 58 |
59 // The selected TabContents is about to change from |old_contents|. | 59 // The selected TabContents is about to change from |old_contents|. |
60 // This gives observers a chance to prepare for an impending switch before it | 60 // This gives observers a chance to prepare for an impending switch before it |
61 // happens. | 61 // happens. |
62 virtual void TabDeselected(TabContentsWrapper* contents); | 62 virtual void TabDeselected(TabContentsWrapper* contents); |
63 | 63 |
| 64 // Invoked any time the selection may have changed. |old_contents| identifies |
| 65 // the previously selected contents. It is entirely possible for the newly |
| 66 // selected tab contents to match |old_contents|. |user_gesture| specifies |
| 67 // whether or not this was done by a user input event (e.g. clicking on a tab, |
| 68 // keystroke) or as a side-effect of some other function. |
| 69 // |
| 70 // This implementation invokes |TabSelectedAt| only if the new and old |
| 71 // contents differ. If you only care about when the selected contents changes, |
| 72 // override |TabSelectedAt|. |
| 73 virtual void TabSelectionChanged(TabStripModel* model, |
| 74 TabContentsWrapper* old_contents, |
| 75 bool user_gesture); |
| 76 |
64 // The selected TabContents changed from |old_contents| to |new_contents| at | 77 // The selected TabContents changed from |old_contents| to |new_contents| at |
65 // |index|. |user_gesture| specifies whether or not this was done by a user | 78 // |index|. |user_gesture| specifies whether or not this was done by a user |
66 // input event (e.g. clicking on a tab, keystroke) or as a side-effect of | 79 // input event (e.g. clicking on a tab, keystroke) or as a side-effect of |
67 // some other function. | 80 // some other function. |
| 81 // |
| 82 // NOTE: this is only invoked when the selected tab contents changes, if you |
| 83 // care about all changes to the selection, override |TabSelectionChanged| |
| 84 // instead. |
68 virtual void TabSelectedAt(TabContentsWrapper* old_contents, | 85 virtual void TabSelectedAt(TabContentsWrapper* old_contents, |
69 TabContentsWrapper* new_contents, | 86 TabContentsWrapper* new_contents, |
70 int index, | 87 int index, |
71 bool user_gesture); | 88 bool user_gesture); |
72 | 89 |
73 // The specified TabContents at |from_index| was moved to |to_index|. | 90 // The specified TabContents at |from_index| was moved to |to_index|. |
74 virtual void TabMoved(TabContentsWrapper* contents, | 91 virtual void TabMoved(TabContentsWrapper* contents, |
75 int from_index, | 92 int from_index, |
76 int to_index); | 93 int to_index); |
77 | 94 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 130 |
114 // Sent when the tabstrip model is about to be deleted and any reference held | 131 // Sent when the tabstrip model is about to be deleted and any reference held |
115 // must be dropped. | 132 // must be dropped. |
116 virtual void TabStripModelDeleted(); | 133 virtual void TabStripModelDeleted(); |
117 | 134 |
118 protected: | 135 protected: |
119 virtual ~TabStripModelObserver() {} | 136 virtual ~TabStripModelObserver() {} |
120 }; | 137 }; |
121 | 138 |
122 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_OBSERVER_H_ | 139 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_OBSERVER_H_ |
OLD | NEW |