| 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_TABS_TAB_STRIP_MODEL_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_OBSERVER_H_ | 6 #define CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_OBSERVER_H_ |
| 7 | 7 |
| 8 class TabContents; | |
| 9 class TabStripModel; | 8 class TabStripModel; |
| 10 class TabStripSelectionModel; | 9 class TabStripSelectionModel; |
| 11 | 10 |
| 12 namespace content { | 11 namespace content { |
| 13 class WebContents; | 12 class WebContents; |
| 14 } | 13 } |
| 15 | 14 |
| 16 //////////////////////////////////////////////////////////////////////////////// | 15 //////////////////////////////////////////////////////////////////////////////// |
| 17 // | 16 // |
| 18 // TabStripModelObserver | 17 // TabStripModelObserver |
| 19 // | 18 // |
| 20 // Objects implement this interface when they wish to be notified of changes | 19 // Objects implement this interface when they wish to be notified of changes |
| 21 // to the TabStripModel. | 20 // to the TabStripModel. |
| 22 // | 21 // |
| 23 // Two major implementers are the TabStrip, which uses notifications sent | 22 // Two major implementers are the TabStrip, which uses notifications sent |
| 24 // via this interface to update the presentation of the strip, and the Browser | 23 // via this interface to update the presentation of the strip, and the Browser |
| 25 // object, which updates bookkeeping and shows/hides individual TabContentses. | 24 // object, which updates bookkeeping and shows/hides individual WebContentses. |
| 26 // | 25 // |
| 27 // Register your TabStripModelObserver with the TabStripModel using its | 26 // Register your TabStripModelObserver with the TabStripModel using its |
| 28 // Add/RemoveObserver methods. | 27 // Add/RemoveObserver methods. |
| 29 // | 28 // |
| 30 //////////////////////////////////////////////////////////////////////////////// | 29 //////////////////////////////////////////////////////////////////////////////// |
| 31 class TabStripModelObserver { | 30 class TabStripModelObserver { |
| 32 public: | 31 public: |
| 33 // Enumeration of the possible values supplied to TabChangedAt. | 32 // Enumeration of the possible values supplied to TabChangedAt. |
| 34 enum TabChangeType { | 33 enum TabChangeType { |
| 35 // Only the loading state changed. | 34 // Only the loading state changed. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 96 |
| 98 // The specified WebContents at |index| changed in some way. |contents| | 97 // The specified WebContents at |index| changed in some way. |contents| |
| 99 // may be an entirely different object and the old value is no longer | 98 // may be an entirely different object and the old value is no longer |
| 100 // available by the time this message is delivered. | 99 // available by the time this message is delivered. |
| 101 // | 100 // |
| 102 // See TabChangeType for a description of |change_type|. | 101 // See TabChangeType for a description of |change_type|. |
| 103 virtual void TabChangedAt(content::WebContents* contents, | 102 virtual void TabChangedAt(content::WebContents* contents, |
| 104 int index, | 103 int index, |
| 105 TabChangeType change_type); | 104 TabChangeType change_type); |
| 106 | 105 |
| 107 // The tab contents was replaced at the specified index. This is invoked | 106 // The WebContents was replaced at the specified index. This is invoked |
| 108 // when instant is enabled and the user navigates by way of instant or when | 107 // when instant is enabled and the user navigates by way of instant or when |
| 109 // prerendering swaps in a prerendered TabContents. | 108 // prerendering swaps in a prerendered WebContents. |
| 110 virtual void TabReplacedAt(TabStripModel* tab_strip_model, | 109 virtual void TabReplacedAt(TabStripModel* tab_strip_model, |
| 111 TabContents* old_contents, | 110 content::WebContents* old_contents, |
| 112 TabContents* new_contents, | 111 content::WebContents* new_contents, |
| 113 int index); | 112 int index); |
| 114 | 113 |
| 115 // Invoked when the pinned state of a tab changes. See note in | 114 // Invoked when the pinned state of a tab changes. See note in |
| 116 // TabMiniStateChanged as to how this relates to TabMiniStateChanged. | 115 // TabMiniStateChanged as to how this relates to TabMiniStateChanged. |
| 117 virtual void TabPinnedStateChanged(content::WebContents* contents, int index); | 116 virtual void TabPinnedStateChanged(content::WebContents* contents, int index); |
| 118 | 117 |
| 119 // Invoked if the mini state of a tab changes. | 118 // Invoked if the mini state of a tab changes. |
| 120 // NOTE: This is sent when the pinned state of a non-app tab changes and is | 119 // NOTE: This is sent when the pinned state of a non-app tab changes and is |
| 121 // sent in addition to TabPinnedStateChanged. UI code typically need not care | 120 // sent in addition to TabPinnedStateChanged. UI code typically need not care |
| 122 // about TabPinnedStateChanged, but instead this. | 121 // about TabPinnedStateChanged, but instead this. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 135 | 134 |
| 136 // Sent when the tabstrip model is about to be deleted and any reference held | 135 // Sent when the tabstrip model is about to be deleted and any reference held |
| 137 // must be dropped. | 136 // must be dropped. |
| 138 virtual void TabStripModelDeleted(); | 137 virtual void TabStripModelDeleted(); |
| 139 | 138 |
| 140 protected: | 139 protected: |
| 141 virtual ~TabStripModelObserver() {} | 140 virtual ~TabStripModelObserver() {} |
| 142 }; | 141 }; |
| 143 | 142 |
| 144 #endif // CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_OBSERVER_H_ | 143 #endif // CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_OBSERVER_H_ |
| OLD | NEW |