| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 21 matching lines...) Expand all Loading... |
| 32 // Only the loading state changed. | 32 // Only the loading state changed. |
| 33 LOADING_ONLY, | 33 LOADING_ONLY, |
| 34 | 34 |
| 35 // Only the title changed and page isn't loading. | 35 // Only the title changed and page isn't loading. |
| 36 TITLE_NOT_LOADING, | 36 TITLE_NOT_LOADING, |
| 37 | 37 |
| 38 // Change not characterized by LOADING_ONLY or TITLE_NOT_LOADING. | 38 // Change not characterized by LOADING_ONLY or TITLE_NOT_LOADING. |
| 39 ALL | 39 ALL |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 // A new TabContents was inserted into the TabStripModel at the specified | 42 // A new TabContentsWrapper was inserted into the TabStripModel at the |
| 43 // index. |foreground| is whether or not it was opened in the foreground | 43 // specified index. |foreground| is whether or not it was opened in the |
| 44 // (selected). | 44 // foreground (selected). |
| 45 virtual void TabInsertedAt(TabContentsWrapper* contents, | 45 virtual void TabInsertedAt(TabContentsWrapper* contents, |
| 46 int index, | 46 int index, |
| 47 bool foreground); | 47 bool foreground); |
| 48 | 48 |
| 49 // The specified TabContents at |index| is being closed (and eventually | 49 // The specified TabContentsWrapper at |index| is being closed (and eventually |
| 50 // destroyed). |tab_strip_model| is the TabStripModel the tab was part of. | 50 // destroyed). |tab_strip_model| is the TabStripModel the tab was part of. |
| 51 virtual void TabClosingAt(TabStripModel* tab_strip_model, | 51 virtual void TabClosingAt(TabStripModel* tab_strip_model, |
| 52 TabContentsWrapper* contents, | 52 TabContentsWrapper* contents, |
| 53 int index); | 53 int index); |
| 54 | 54 |
| 55 // The specified TabContents at |index| is being detached, perhaps to be | 55 // The specified TabContentsWrapper at |index| is being detached, perhaps to |
| 56 // inserted in another TabStripModel. The implementer should take whatever | 56 // be inserted in another TabStripModel. The implementer should take whatever |
| 57 // action is necessary to deal with the TabContents no longer being present. | 57 // action is necessary to deal with the TabContentsWrapper no longer being |
| 58 // present. |
| 58 virtual void TabDetachedAt(TabContentsWrapper* contents, int index); | 59 virtual void TabDetachedAt(TabContentsWrapper* contents, int index); |
| 59 | 60 |
| 60 // The active TabContents is about to change from |old_contents|. | 61 // The active TabContentsWrapper is about to change from |old_contents|. |
| 61 // This gives observers a chance to prepare for an impending switch before it | 62 // This gives observers a chance to prepare for an impending switch before it |
| 62 // happens. | 63 // happens. |
| 63 virtual void TabDeactivated(TabContentsWrapper* contents); | 64 virtual void TabDeactivated(TabContentsWrapper* contents); |
| 64 | 65 |
| 65 // Sent when the active tab changes. The previously active tab is identified | 66 // Sent when the active tab changes. The previously active tab is identified |
| 66 // by |old_contents| and the newly active tab by |new_contents|. |index| is | 67 // by |old_contents| and the newly active tab by |new_contents|. |index| is |
| 67 // the index of |new_contents|. |user_gesture| specifies whether or not this | 68 // the index of |new_contents|. |user_gesture| specifies whether or not this |
| 68 // was done by a user input event (e.g. clicking on a tab, keystroke) or as a | 69 // was done by a user input event (e.g. clicking on a tab, keystroke) or as a |
| 69 // side-effect of some other function. | 70 // side-effect of some other function. |
| 70 // Note: It is possible for the selection to change while the active tab | 71 // Note: It is possible for the selection to change while the active tab |
| 71 // remains unchanged. For example, control-click may not change the active tab | 72 // remains unchanged. For example, control-click may not change the active tab |
| 72 // but does change the selection. In this case |ActiveTabChanged| is not sent. | 73 // but does change the selection. In this case |ActiveTabChanged| is not sent. |
| 73 // If you care about any changes to the selection, override | 74 // If you care about any changes to the selection, override |
| 74 // TabSelectionChanged. | 75 // TabSelectionChanged. |
| 75 virtual void ActiveTabChanged(TabContentsWrapper* old_contents, | 76 virtual void ActiveTabChanged(TabContentsWrapper* old_contents, |
| 76 TabContentsWrapper* new_contents, | 77 TabContentsWrapper* new_contents, |
| 77 int index, | 78 int index, |
| 78 bool user_gesture); | 79 bool user_gesture); |
| 79 | 80 |
| 80 // Sent when the selection changes in |tab_strip_model|. More precisely when | 81 // Sent when the selection changes in |tab_strip_model|. More precisely when |
| 81 // selected tabs, anchor tab or active tab change. |old_model| is a snapshot | 82 // selected tabs, anchor tab or active tab change. |old_model| is a snapshot |
| 82 // of the selection model before the change. See also ActiveTabChanged for | 83 // of the selection model before the change. See also ActiveTabChanged for |
| 83 // details. | 84 // details. |
| 84 virtual void TabSelectionChanged(TabStripModel* tab_strip_model, | 85 virtual void TabSelectionChanged(TabStripModel* tab_strip_model, |
| 85 const TabStripSelectionModel& old_model); | 86 const TabStripSelectionModel& old_model); |
| 86 | 87 |
| 87 // The specified TabContents at |from_index| was moved to |to_index|. | 88 // The specified TabContentsWrapper at |from_index| was moved to |to_index|. |
| 88 virtual void TabMoved(TabContentsWrapper* contents, | 89 virtual void TabMoved(TabContentsWrapper* contents, |
| 89 int from_index, | 90 int from_index, |
| 90 int to_index); | 91 int to_index); |
| 91 | 92 |
| 92 // The specified TabContents at |index| changed in some way. |contents| may | 93 // The specified TabContentsWrapper at |index| changed in some way. |contents| |
| 93 // be an entirely different object and the old value is no longer available | 94 // may be an entirely different object and the old value is no longer |
| 94 // by the time this message is delivered. | 95 // available by the time this message is delivered. |
| 95 // | 96 // |
| 96 // See TabChangeType for a description of |change_type|. | 97 // See TabChangeType for a description of |change_type|. |
| 97 virtual void TabChangedAt(TabContentsWrapper* contents, | 98 virtual void TabChangedAt(TabContentsWrapper* contents, |
| 98 int index, | 99 int index, |
| 99 TabChangeType change_type); | 100 TabChangeType change_type); |
| 100 | 101 |
| 101 // The tab contents was replaced at the specified index. This is invoked | 102 // The tab contents was replaced at the specified index. This is invoked |
| 102 // when instant is enabled and the user navigates by way of instant or when | 103 // when instant is enabled and the user navigates by way of instant or when |
| 103 // prerendering swaps in a prerendered TabContents. | 104 // prerendering swaps in a prerendered TabContentsWrapper. |
| 104 virtual void TabReplacedAt(TabStripModel* tab_strip_model, | 105 virtual void TabReplacedAt(TabStripModel* tab_strip_model, |
| 105 TabContentsWrapper* old_contents, | 106 TabContentsWrapper* old_contents, |
| 106 TabContentsWrapper* new_contents, | 107 TabContentsWrapper* new_contents, |
| 107 int index); | 108 int index); |
| 108 | 109 |
| 109 // Invoked when the pinned state of a tab changes. See note in | 110 // Invoked when the pinned state of a tab changes. See note in |
| 110 // TabMiniStateChanged as to how this relates to TabMiniStateChanged. | 111 // TabMiniStateChanged as to how this relates to TabMiniStateChanged. |
| 111 virtual void TabPinnedStateChanged(TabContentsWrapper* contents, int index); | 112 virtual void TabPinnedStateChanged(TabContentsWrapper* contents, int index); |
| 112 | 113 |
| 113 // Invoked if the mini state of a tab changes. | 114 // Invoked if the mini state of a tab changes. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 132 | 133 |
| 133 // Invoked when an active/selected tab at |index| is selected again (ie - the | 134 // Invoked when an active/selected tab at |index| is selected again (ie - the |
| 134 // active/foreground tab is clicked). | 135 // active/foreground tab is clicked). |
| 135 virtual void ActiveTabClicked(int index); | 136 virtual void ActiveTabClicked(int index); |
| 136 | 137 |
| 137 protected: | 138 protected: |
| 138 virtual ~TabStripModelObserver() {} | 139 virtual ~TabStripModelObserver() {} |
| 139 }; | 140 }; |
| 140 | 141 |
| 141 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_OBSERVER_H_ | 142 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_OBSERVER_H_ |
| OLD | NEW |