Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: chrome/browser/tabs/tab_strip_model_observer.h

Issue 7033048: Multi-tab: Adding new Notification when tab selection changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing comments. Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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;
11 class TabStripSelectionModel;
11 12
12 //////////////////////////////////////////////////////////////////////////////// 13 ////////////////////////////////////////////////////////////////////////////////
13 // 14 //
14 // TabStripModelObserver 15 // TabStripModelObserver
15 // 16 //
16 // Objects implement this interface when they wish to be notified of changes 17 // Objects implement this interface when they wish to be notified of changes
17 // to the TabStripModel. 18 // to the TabStripModel.
18 // 19 //
19 // Two major implementers are the TabStrip, which uses notifications sent 20 // Two major implementers are the TabStrip, which uses notifications sent
20 // via this interface to update the presentation of the strip, and the Browser 21 // via this interface to update the presentation of the strip, and the Browser
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // The specified TabContents at |index| is being detached, perhaps to be 55 // The specified TabContents at |index| is being detached, perhaps to be
55 // inserted in another TabStripModel. The implementer should take whatever 56 // inserted in another TabStripModel. The implementer should take whatever
56 // action is necessary to deal with the TabContents no longer being present. 57 // action is necessary to deal with the TabContents no longer being present.
57 virtual void TabDetachedAt(TabContentsWrapper* contents, int index); 58 virtual void TabDetachedAt(TabContentsWrapper* contents, int index);
58 59
59 // The selected TabContents is about to change from |old_contents|. 60 // The selected TabContents is about to change from |old_contents|.
60 // This gives observers a chance to prepare for an impending switch before it 61 // This gives observers a chance to prepare for an impending switch before it
61 // happens. 62 // happens.
62 virtual void TabDeselected(TabContentsWrapper* contents); 63 virtual void TabDeselected(TabContentsWrapper* contents);
63 64
64 // Sent when the selection changes. The previously selected tab is identified 65 // Sent when the selection changes. The previously selected tab is identified
sky 2011/06/03 15:35:56 'Sent when the selection changes' -> 'Sent when th
dpapad 2011/06/03 17:49:01 Done.
65 // by |old_contents| and the newly selected tab by |new_contents|. |index| is 66 // 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 67 // the index of |new_contents|. |user_gesture| specifies whether or not this
67 // 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
69 // 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|
71 // 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 68 // was done by a user input event (e.g. clicking on a tab, keystroke) or as a
73 // side-effect of some other function. 69 // side-effect of some other function.
sky 2011/06/03 15:35:56 Also add something about 'TabSelectionChanged'. Ma
dpapad 2011/06/03 17:49:01 Done.
74 //
75 // TODO(dpapad): Add TabSelectionChanged method for when the selected tabs
76 // change.
77 virtual void ActiveTabChanged(TabContentsWrapper* old_contents, 70 virtual void ActiveTabChanged(TabContentsWrapper* old_contents,
78 TabContentsWrapper* new_contents, 71 TabContentsWrapper* new_contents,
79 int index, 72 int index,
80 bool user_gesture); 73 bool user_gesture);
81 74
75 // Sent when the selection changes. More precisely when selected tabs, anchor
76 // tab or active tab change.
sky 2011/06/03 15:35:56 Add something about see also ActiveTabChanged for
dpapad 2011/06/03 17:49:01 Done.
77 virtual void TabSelectionChanged(const TabStripSelectionModel& model);
sky 2011/06/03 15:35:56 model -> old_model. And also document what it is.
dpapad 2011/06/03 17:49:01 Done.
78
82 // The specified TabContents at |from_index| was moved to |to_index|. 79 // The specified TabContents at |from_index| was moved to |to_index|.
83 virtual void TabMoved(TabContentsWrapper* contents, 80 virtual void TabMoved(TabContentsWrapper* contents,
84 int from_index, 81 int from_index,
85 int to_index); 82 int to_index);
86 83
87 // The specified TabContents at |index| changed in some way. |contents| may 84 // 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 85 // be an entirely different object and the old value is no longer available
89 // by the time this message is delivered. 86 // by the time this message is delivered.
90 // 87 //
91 // See TabChangeType for a description of |change_type|. 88 // See TabChangeType for a description of |change_type|.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 124
128 // Invoked when an active/selected tab at |index| is selected again (ie - the 125 // Invoked when an active/selected tab at |index| is selected again (ie - the
129 // active/foreground tab is clicked). 126 // active/foreground tab is clicked).
130 virtual void ActiveTabClicked(int index); 127 virtual void ActiveTabClicked(int index);
131 128
132 protected: 129 protected:
133 virtual ~TabStripModelObserver() {} 130 virtual ~TabStripModelObserver() {}
134 }; 131 };
135 132
136 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_OBSERVER_H_ 133 #endif // CHROME_BROWSER_TABS_TAB_STRIP_MODEL_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698