Chromium Code Reviews| 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 #include <vector> | |
| 10 | |
| 9 class TabContentsWrapper; | 11 class TabContentsWrapper; |
| 10 class TabStripModel; | 12 class TabStripModel; |
| 11 | 13 |
| 12 //////////////////////////////////////////////////////////////////////////////// | 14 //////////////////////////////////////////////////////////////////////////////// |
| 13 // | 15 // |
| 14 // TabStripModelObserver | 16 // TabStripModelObserver |
| 15 // | 17 // |
| 16 // Objects implement this interface when they wish to be notified of changes | 18 // Objects implement this interface when they wish to be notified of changes |
| 17 // to the TabStripModel. | 19 // to the TabStripModel. |
| 18 // | 20 // |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 // Sent when the selection changes. The previously selected tab is identified | 66 // Sent when the selection changes. The previously selected tab is identified |
| 65 // by |old_contents| and the newly selected tab by |new_contents|. |index| is | 67 // by |old_contents| and the newly selected tab by |new_contents|. |index| is |
| 66 // the index of |new_contents|. When using multiple selection this may be sent | 68 // the index of |new_contents|. When using multiple selection this may be sent |
| 67 // even when the active tab has not changed. For example, if the selection is | 69 // even when the active tab has not changed. For example, if the selection is |
| 68 // extended this method is invoked to inform observers the selection has | 70 // extended this method is invoked to inform observers the selection has |
| 69 // changed, but |old_contents| and |new_contents| are the same. If you only | 71 // changed, but |old_contents| and |new_contents| are the same. If you only |
| 70 // care about when the active tab changes, check for when |old_contents| | 72 // care about when the active tab changes, check for when |old_contents| |
| 71 // differs from |new_contents|. |user_gesture| specifies whether or not this | 73 // differs from |new_contents|. |user_gesture| specifies whether or not this |
| 72 // was done by a user input event (e.g. clicking on a tab, keystroke) or as a | 74 // was done by a user input event (e.g. clicking on a tab, keystroke) or as a |
| 73 // side-effect of some other function. | 75 // side-effect of some other function. |
| 74 // | |
| 75 // TODO(dpapad): Add TabSelectionChanged method for when the selected tabs | |
| 76 // change. | |
| 77 virtual void ActiveTabChanged(TabContentsWrapper* old_contents, | 76 virtual void ActiveTabChanged(TabContentsWrapper* old_contents, |
| 78 TabContentsWrapper* new_contents, | 77 TabContentsWrapper* new_contents, |
| 79 int index, | 78 int index, |
| 80 bool user_gesture); | 79 bool user_gesture); |
| 81 | 80 |
| 81 // Sent when the selection changes. |previously_selected| and | |
| 82 // |currently_selected| contain the indices of the tabs that were previously | |
| 83 // and currently selected respectively. | |
| 84 virtual void TabSelectionChanged(const std::vector<int>& previously_selected, | |
|
sky
2011/06/01 20:56:04
Add test coverage of this.
Also, it seems like you
dpapad
2011/06/02 00:28:22
Yes, currently TabSelectionChanged() is called fro
sky
2011/06/02 16:07:14
You're right on 1. My intention with the two metho
| |
| 85 const std::vector<int>& currently_selected); | |
| 86 | |
| 82 // The specified TabContents at |from_index| was moved to |to_index|. | 87 // The specified TabContents at |from_index| was moved to |to_index|. |
| 83 virtual void TabMoved(TabContentsWrapper* contents, | 88 virtual void TabMoved(TabContentsWrapper* contents, |
| 84 int from_index, | 89 int from_index, |
| 85 int to_index); | 90 int to_index); |
| 86 | 91 |
| 87 // The specified TabContents at |index| changed in some way. |contents| may | 92 // The specified TabContents at |index| changed in some way. |contents| may |
| 88 // 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 |
| 89 // by the time this message is delivered. | 94 // by the time this message is delivered. |
| 90 // | 95 // |
| 91 // See TabChangeType for a description of |change_type|. | 96 // See TabChangeType for a description of |change_type|. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 | 132 |
| 128 // Invoked when an active/selected tab at |index| is selected again (ie - the | 133 // Invoked when an active/selected tab at |index| is selected again (ie - the |
| 129 // active/foreground tab is clicked). | 134 // active/foreground tab is clicked). |
| 130 virtual void ActiveTabClicked(int index); | 135 virtual void ActiveTabClicked(int index); |
| 131 | 136 |
| 132 protected: | 137 protected: |
| 133 virtual ~TabStripModelObserver() {} | 138 virtual ~TabStripModelObserver() {} |
| 134 }; | 139 }; |
| 135 | 140 |
| 136 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_OBSERVER_H_ | 141 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_OBSERVER_H_ |
| OLD | NEW |