| 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_H_ | 5 #ifndef CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_ |
| 6 #define CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_ | 6 #define CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 // Change not characterized by LOADING_ONLY or TITLE_NOT_LOADING. | 53 // Change not characterized by LOADING_ONLY or TITLE_NOT_LOADING. |
| 54 ALL | 54 ALL |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 // A new TabContents was inserted into the TabStripModel at the specified | 57 // A new TabContents was inserted into the TabStripModel at the specified |
| 58 // index. |foreground| is whether or not it was opened in the foreground | 58 // index. |foreground| is whether or not it was opened in the foreground |
| 59 // (selected). | 59 // (selected). |
| 60 virtual void TabInsertedAt(TabContents* contents, | 60 virtual void TabInsertedAt(TabContents* contents, |
| 61 int index, | 61 int index, |
| 62 bool foreground) {} | 62 bool foreground); |
| 63 | 63 |
| 64 // The specified TabContents at |index| is being closed (and eventually | 64 // The specified TabContents at |index| is being closed (and eventually |
| 65 // destroyed). | 65 // destroyed). |
| 66 virtual void TabClosingAt(TabContents* contents, int index) {} | 66 virtual void TabClosingAt(TabContents* contents, int index); |
| 67 | 67 |
| 68 // The specified TabContents at |index| is being detached, perhaps to be | 68 // The specified TabContents at |index| is being detached, perhaps to be |
| 69 // inserted in another TabStripModel. The implementer should take whatever | 69 // inserted in another TabStripModel. The implementer should take whatever |
| 70 // action is necessary to deal with the TabContents no longer being present. | 70 // action is necessary to deal with the TabContents no longer being present. |
| 71 virtual void TabDetachedAt(TabContents* contents, int index) {} | 71 virtual void TabDetachedAt(TabContents* contents, int index); |
| 72 | 72 |
| 73 // The selected TabContents is about to change from |old_contents| at |index|. | 73 // The selected TabContents is about to change from |old_contents| at |index|. |
| 74 // This gives observers a chance to prepare for an impending switch before it | 74 // This gives observers a chance to prepare for an impending switch before it |
| 75 // happens. | 75 // happens. |
| 76 virtual void TabDeselectedAt(TabContents* contents, int index) {} | 76 virtual void TabDeselectedAt(TabContents* contents, int index); |
| 77 | 77 |
| 78 // The selected TabContents changed from |old_contents| to |new_contents| at | 78 // The selected TabContents changed from |old_contents| to |new_contents| at |
| 79 // |index|. |user_gesture| specifies whether or not this was done by a user | 79 // |index|. |user_gesture| specifies whether or not this was done by a user |
| 80 // input event (e.g. clicking on a tab, keystroke) or as a side-effect of | 80 // input event (e.g. clicking on a tab, keystroke) or as a side-effect of |
| 81 // some other function. | 81 // some other function. |
| 82 virtual void TabSelectedAt(TabContents* old_contents, | 82 virtual void TabSelectedAt(TabContents* old_contents, |
| 83 TabContents* new_contents, | 83 TabContents* new_contents, |
| 84 int index, | 84 int index, |
| 85 bool user_gesture) {} | 85 bool user_gesture); |
| 86 | 86 |
| 87 // The specified TabContents at |from_index| was moved to |to_index|. | 87 // The specified TabContents at |from_index| was moved to |to_index|. |
| 88 virtual void TabMoved(TabContents* contents, | 88 virtual void TabMoved(TabContents* contents, |
| 89 int from_index, | 89 int from_index, |
| 90 int to_index) {} | 90 int to_index); |
| 91 | 91 |
| 92 // The specified TabContents at |index| changed in some way. |contents| may | 92 // The specified TabContents at |index| changed in some way. |contents| may |
| 93 // be an entirely different object and the old value is no longer available | 93 // be an entirely different object and the old value is no longer available |
| 94 // by the time this message is delivered. | 94 // by the time this message is delivered. |
| 95 // | 95 // |
| 96 // See TabChangeType for a description of |change_type|. | 96 // See TabChangeType for a description of |change_type|. |
| 97 virtual void TabChangedAt(TabContents* contents, int index, | 97 virtual void TabChangedAt(TabContents* contents, int index, |
| 98 TabChangeType change_type) {} | 98 TabChangeType change_type); |
| 99 | 99 |
| 100 // The tab contents was replaced at the specified index. This is invoked when | 100 // The tab contents was replaced at the specified index. This is invoked when |
| 101 // a tab becomes phantom. See description of phantom tabs in class description | 101 // a tab becomes phantom. See description of phantom tabs in class description |
| 102 // of TabStripModel for details. | 102 // of TabStripModel for details. |
| 103 virtual void TabReplacedAt(TabContents* old_contents, | 103 virtual void TabReplacedAt(TabContents* old_contents, |
| 104 TabContents* new_contents, int index) {} | 104 TabContents* new_contents, int index); |
| 105 | 105 |
| 106 // Invoked when the pinned state of a tab changes. This is not invoked if the | 106 // Invoked when the pinned state of a tab changes. This is not invoked if the |
| 107 // tab ends up moving as a result of the mini state changing. | 107 // tab ends up moving as a result of the mini state changing. |
| 108 // See note in TabMiniStateChanged as to how this relates to | 108 // See note in TabMiniStateChanged as to how this relates to |
| 109 // TabMiniStateChanged. | 109 // TabMiniStateChanged. |
| 110 virtual void TabPinnedStateChanged(TabContents* contents, int index) {} | 110 virtual void TabPinnedStateChanged(TabContents* contents, int index); |
| 111 | 111 |
| 112 // Invoked if the mini state of a tab changes. This is not invoked if the | 112 // Invoked if the mini state of a tab changes. This is not invoked if the |
| 113 // tab ends up moving as a result of the mini state changing. | 113 // tab ends up moving as a result of the mini state changing. |
| 114 // NOTE: this is sent when the pinned state of a non-app tab changes and is | 114 // NOTE: this is sent when the pinned state of a non-app tab changes and is |
| 115 // sent in addition to TabPinnedStateChanged. UI code typically need not care | 115 // sent in addition to TabPinnedStateChanged. UI code typically need not care |
| 116 // about TabPinnedStateChanged, but instead this. | 116 // about TabPinnedStateChanged, but instead this. |
| 117 virtual void TabMiniStateChanged(TabContents* contents, int index) {} | 117 virtual void TabMiniStateChanged(TabContents* contents, int index); |
| 118 | 118 |
| 119 // Invoked when the blocked state of a tab changes. | 119 // Invoked when the blocked state of a tab changes. |
| 120 // NOTE: This is invoked when a tab becomes blocked/unblocked by a tab modal | 120 // NOTE: This is invoked when a tab becomes blocked/unblocked by a tab modal |
| 121 // window. | 121 // window. |
| 122 virtual void TabBlockedStateChanged(TabContents* contents, int index) {} | 122 virtual void TabBlockedStateChanged(TabContents* contents, int index); |
| 123 | 123 |
| 124 // The TabStripModel now no longer has any phantom tabs. The implementer may | 124 // The TabStripModel now no longer has any phantom tabs. The implementer may |
| 125 // use this as a trigger to try and close the window containing the | 125 // use this as a trigger to try and close the window containing the |
| 126 // TabStripModel, for example... | 126 // TabStripModel, for example... |
| 127 virtual void TabStripEmpty() {} | 127 virtual void TabStripEmpty(); |
| 128 | 128 |
| 129 // Sent when the tabstrip model is about to be deleted and any reference held | 129 // Sent when the tabstrip model is about to be deleted and any reference held |
| 130 // must be dropped. | 130 // must be dropped. |
| 131 virtual void TabStripModelDeleted() {} | 131 virtual void TabStripModelDeleted(); |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 /////////////////////////////////////////////////////////////////////////////// | 134 /////////////////////////////////////////////////////////////////////////////// |
| 135 // | 135 // |
| 136 // TabStripModelDelegate | 136 // TabStripModelDelegate |
| 137 // | 137 // |
| 138 // A delegate interface that the TabStripModel uses to perform work that it | 138 // A delegate interface that the TabStripModel uses to perform work that it |
| 139 // can't do itself, such as obtain a container HWND for creating new | 139 // can't do itself, such as obtain a container HWND for creating new |
| 140 // TabContents, creating new TabStripModels for detached tabs, etc. | 140 // TabContents, creating new TabStripModels for detached tabs, etc. |
| 141 // | 141 // |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 virtual bool CanCloseContentsAt(int index) = 0; | 222 virtual bool CanCloseContentsAt(int index) = 0; |
| 223 | 223 |
| 224 // Returns true if we should allow "bookmark all tabs" in this window; this is | 224 // Returns true if we should allow "bookmark all tabs" in this window; this is |
| 225 // true when there is more than one bookmarkable tab open. | 225 // true when there is more than one bookmarkable tab open. |
| 226 virtual bool CanBookmarkAllTabs() const = 0; | 226 virtual bool CanBookmarkAllTabs() const = 0; |
| 227 | 227 |
| 228 // Creates a bookmark folder containing a bookmark for all open tabs. | 228 // Creates a bookmark folder containing a bookmark for all open tabs. |
| 229 virtual void BookmarkAllTabs() = 0; | 229 virtual void BookmarkAllTabs() = 0; |
| 230 | 230 |
| 231 // Returns true if any of the tabs can be closed. | 231 // Returns true if any of the tabs can be closed. |
| 232 virtual bool CanCloseTab() const { | 232 virtual bool CanCloseTab() const; |
| 233 return true; | |
| 234 } | |
| 235 | 233 |
| 236 // Returns true if the vertical tabstrip presentation should be used. | 234 // Returns true if the vertical tabstrip presentation should be used. |
| 237 virtual bool UseVerticalTabs() const = 0; | 235 virtual bool UseVerticalTabs() const = 0; |
| 238 | 236 |
| 239 // Toggles the use of the vertical tabstrip. | 237 // Toggles the use of the vertical tabstrip. |
| 240 virtual void ToggleUseVerticalTabs() = 0; | 238 virtual void ToggleUseVerticalTabs() = 0; |
| 241 | 239 |
| 242 // Set the visiblity of the toolbar. | 240 // Set the visiblity of the toolbar. |
| 243 virtual void SetToolbarVisibility(bool value) = 0; | 241 virtual void SetToolbarVisibility(bool value) = 0; |
| 244 }; | 242 }; |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 typedef ObserverList<TabStripModelObserver> TabStripModelObservers; | 812 typedef ObserverList<TabStripModelObserver> TabStripModelObservers; |
| 815 TabStripModelObservers observers_; | 813 TabStripModelObservers observers_; |
| 816 | 814 |
| 817 // A scoped container for notification registries. | 815 // A scoped container for notification registries. |
| 818 NotificationRegistrar registrar_; | 816 NotificationRegistrar registrar_; |
| 819 | 817 |
| 820 DISALLOW_COPY_AND_ASSIGN(TabStripModel); | 818 DISALLOW_COPY_AND_ASSIGN(TabStripModel); |
| 821 }; | 819 }; |
| 822 | 820 |
| 823 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_ | 821 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_H_ |
| OLD | NEW |