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 TabContents; | 9 class TabContentsWrapper; |
10 class TabStripModel; | 10 class TabStripModel; |
11 | 11 |
12 //////////////////////////////////////////////////////////////////////////////// | 12 //////////////////////////////////////////////////////////////////////////////// |
13 // | 13 // |
14 // TabStripModelObserver | 14 // TabStripModelObserver |
15 // | 15 // |
16 // Objects implement this interface when they wish to be notified of changes | 16 // Objects implement this interface when they wish to be notified of changes |
17 // to the TabStripModel. | 17 // to the TabStripModel. |
18 // | 18 // |
19 // Two major implementers are the TabStrip, which uses notifications sent | 19 // Two major implementers are the TabStrip, which uses notifications sent |
(...skipping 14 matching lines...) Expand all Loading... |
34 // Only the title changed and page isn't loading. | 34 // Only the title changed and page isn't loading. |
35 TITLE_NOT_LOADING, | 35 TITLE_NOT_LOADING, |
36 | 36 |
37 // Change not characterized by LOADING_ONLY or TITLE_NOT_LOADING. | 37 // Change not characterized by LOADING_ONLY or TITLE_NOT_LOADING. |
38 ALL | 38 ALL |
39 }; | 39 }; |
40 | 40 |
41 // A new TabContents was inserted into the TabStripModel at the specified | 41 // A new TabContents was inserted into the TabStripModel at the specified |
42 // index. |foreground| is whether or not it was opened in the foreground | 42 // index. |foreground| is whether or not it was opened in the foreground |
43 // (selected). | 43 // (selected). |
44 virtual void TabInsertedAt(TabContents* contents, | 44 virtual void TabInsertedAt(TabContentsWrapper* contents, |
45 int index, | 45 int index, |
46 bool foreground); | 46 bool foreground); |
47 | 47 |
48 // The specified TabContents at |index| is being closed (and eventually | 48 // The specified TabContents at |index| is being closed (and eventually |
49 // destroyed). |tab_strip_model| is the TabStripModel the tab was part of. | 49 // destroyed). |tab_strip_model| is the TabStripModel the tab was part of. |
50 virtual void TabClosingAt(TabStripModel* tab_strip_model, | 50 virtual void TabClosingAt(TabStripModel* tab_strip_model, |
51 TabContents* contents, | 51 TabContentsWrapper* contents, |
52 int index); | 52 int index); |
53 | 53 |
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(TabContents* contents, int index); | 57 virtual void TabDetachedAt(TabContentsWrapper* contents, int index); |
58 | 58 |
59 // The selected TabContents is about to change from |old_contents| at |index|. | 59 // The selected TabContents is about to change from |old_contents| at |index|. |
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 TabDeselectedAt(TabContents* contents, int index); | 62 virtual void TabDeselectedAt(TabContentsWrapper* contents, int index); |
63 | 63 |
64 // The selected TabContents changed from |old_contents| to |new_contents| at | 64 // 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 | 65 // |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 | 66 // input event (e.g. clicking on a tab, keystroke) or as a side-effect of |
67 // some other function. | 67 // some other function. |
68 virtual void TabSelectedAt(TabContents* old_contents, | 68 virtual void TabSelectedAt(TabContentsWrapper* old_contents, |
69 TabContents* new_contents, | 69 TabContentsWrapper* new_contents, |
70 int index, | 70 int index, |
71 bool user_gesture); | 71 bool user_gesture); |
72 | 72 |
73 // The specified TabContents at |from_index| was moved to |to_index|. | 73 // The specified TabContents at |from_index| was moved to |to_index|. |
74 virtual void TabMoved(TabContents* contents, | 74 virtual void TabMoved(TabContentsWrapper* contents, |
75 int from_index, | 75 int from_index, |
76 int to_index); | 76 int to_index); |
77 | 77 |
78 // The specified TabContents at |index| changed in some way. |contents| may | 78 // The specified TabContents at |index| changed in some way. |contents| may |
79 // be an entirely different object and the old value is no longer available | 79 // be an entirely different object and the old value is no longer available |
80 // by the time this message is delivered. | 80 // by the time this message is delivered. |
81 // | 81 // |
82 // See TabChangeType for a description of |change_type|. | 82 // See TabChangeType for a description of |change_type|. |
83 virtual void TabChangedAt(TabContents* contents, | 83 virtual void TabChangedAt(TabContentsWrapper* contents, |
84 int index, | 84 int index, |
85 TabChangeType change_type); | 85 TabChangeType change_type); |
86 | 86 |
87 // The tab contents was replaced at the specified index. This is invoked when | 87 // The tab contents was replaced at the specified index. This is invoked when |
88 // a tab becomes phantom. See description of phantom tabs in class description | 88 // a tab becomes phantom. See description of phantom tabs in class description |
89 // of TabStripModel for details. | 89 // of TabStripModel for details. |
90 virtual void TabReplacedAt(TabContents* old_contents, | 90 virtual void TabReplacedAt(TabContentsWrapper* old_contents, |
91 TabContents* new_contents, | 91 TabContentsWrapper* new_contents, |
92 int index); | 92 int index); |
93 | 93 |
94 // Invoked when the pinned state of a tab changes. See note in | 94 // Invoked when the pinned state of a tab changes. See note in |
95 // TabMiniStateChanged as to how this relates to TabMiniStateChanged. | 95 // TabMiniStateChanged as to how this relates to TabMiniStateChanged. |
96 virtual void TabPinnedStateChanged(TabContents* contents, int index); | 96 virtual void TabPinnedStateChanged(TabContentsWrapper* contents, int index); |
97 | 97 |
98 // Invoked if the mini state of a tab changes. | 98 // Invoked if the mini state of a tab changes. |
99 // NOTE: this is sent when the pinned state of a non-app tab changes and is | 99 // NOTE: this is sent when the pinned state of a non-app tab changes and is |
100 // sent in addition to TabPinnedStateChanged. UI code typically need not care | 100 // sent in addition to TabPinnedStateChanged. UI code typically need not care |
101 // about TabPinnedStateChanged, but instead this. | 101 // about TabPinnedStateChanged, but instead this. |
102 virtual void TabMiniStateChanged(TabContents* contents, int index); | 102 virtual void TabMiniStateChanged(TabContentsWrapper* contents, int index); |
103 | 103 |
104 // Invoked when the blocked state of a tab changes. | 104 // Invoked when the blocked state of a tab changes. |
105 // NOTE: This is invoked when a tab becomes blocked/unblocked by a tab modal | 105 // NOTE: This is invoked when a tab becomes blocked/unblocked by a tab modal |
106 // window. | 106 // window. |
107 virtual void TabBlockedStateChanged(TabContents* contents, int index); | 107 virtual void TabBlockedStateChanged(TabContentsWrapper* contents, int index); |
108 | 108 |
109 // The TabStripModel now no longer has any phantom tabs. The implementer may | 109 // The TabStripModel now no longer has any phantom tabs. The implementer may |
110 // use this as a trigger to try and close the window containing the | 110 // use this as a trigger to try and close the window containing the |
111 // TabStripModel, for example... | 111 // TabStripModel, for example... |
112 virtual void TabStripEmpty(); | 112 virtual void TabStripEmpty(); |
113 | 113 |
114 // Sent when the tabstrip model is about to be deleted and any reference held | 114 // Sent when the tabstrip model is about to be deleted and any reference held |
115 // must be dropped. | 115 // must be dropped. |
116 virtual void TabStripModelDeleted(); | 116 virtual void TabStripModelDeleted(); |
117 | 117 |
118 protected: | 118 protected: |
119 virtual ~TabStripModelObserver() {} | 119 virtual ~TabStripModelObserver() {} |
120 }; | 120 }; |
121 | 121 |
122 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_OBSERVER_H_ | 122 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_OBSERVER_H_ |
OLD | NEW |