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

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

Issue 2335203003: Add metrics to keep track of the tab activate/deactivate cycle (Closed)
Patch Set: Addressed comments Created 4 years, 3 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
OLDNEW
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 TabStripModel; 8 class TabStripModel;
9 9
10 namespace content { 10 namespace content {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 CHANGE_REASON_NONE = 0, 50 CHANGE_REASON_NONE = 0,
51 // The active tab changed because the tab's web contents was replaced. 51 // The active tab changed because the tab's web contents was replaced.
52 CHANGE_REASON_REPLACED = 1 << 0, 52 CHANGE_REASON_REPLACED = 1 << 0,
53 // The active tab changed due to a user input event. 53 // The active tab changed due to a user input event.
54 CHANGE_REASON_USER_GESTURE = 1 << 1, 54 CHANGE_REASON_USER_GESTURE = 1 << 1,
55 }; 55 };
56 56
57 // A new WebContents was inserted into the TabStripModel at the 57 // A new WebContents was inserted into the TabStripModel at the
58 // specified index. |foreground| is whether or not it was opened in the 58 // specified index. |foreground| is whether or not it was opened in the
59 // foreground (selected). 59 // foreground (selected).
60 virtual void TabInsertedAt(content::WebContents* contents, 60 virtual void TabInsertedAt(TabStripModel* tab_strip_model,
61 content::WebContents* contents,
61 int index, 62 int index,
62 bool foreground); 63 bool foreground);
63 64
64 // The specified WebContents at |index| is being closed (and eventually 65 // The specified WebContents at |index| is being closed (and eventually
65 // destroyed). |tab_strip_model| is the TabStripModel that contained the tab. 66 // destroyed). |tab_strip_model| is the TabStripModel that contained the tab.
66 virtual void TabClosingAt(TabStripModel* tab_strip_model, 67 virtual void TabClosingAt(TabStripModel* tab_strip_model,
67 content::WebContents* contents, 68 content::WebContents* contents,
68 int index); 69 int index);
69 70
70 // The specified WebContents at |index| is being detached, perhaps to 71 // The specified WebContents at |index| is being detached, perhaps to
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 120
120 // The WebContents was replaced at the specified index. This is invoked 121 // The WebContents was replaced at the specified index. This is invoked
121 // when instant is enabled and the user navigates by way of instant or when 122 // when instant is enabled and the user navigates by way of instant or when
122 // prerendering swaps in a prerendered WebContents. 123 // prerendering swaps in a prerendered WebContents.
123 virtual void TabReplacedAt(TabStripModel* tab_strip_model, 124 virtual void TabReplacedAt(TabStripModel* tab_strip_model,
124 content::WebContents* old_contents, 125 content::WebContents* old_contents,
125 content::WebContents* new_contents, 126 content::WebContents* new_contents,
126 int index); 127 int index);
127 128
128 // Invoked when the pinned state of a tab changes. 129 // Invoked when the pinned state of a tab changes.
129 virtual void TabPinnedStateChanged(content::WebContents* contents, int index); 130 virtual void TabPinnedStateChanged(TabStripModel* tab_strip_model,
131 content::WebContents* contents,
132 int index);
130 133
131 // Invoked when the blocked state of a tab changes. 134 // Invoked when the blocked state of a tab changes.
132 // NOTE: This is invoked when a tab becomes blocked/unblocked by a tab modal 135 // NOTE: This is invoked when a tab becomes blocked/unblocked by a tab modal
133 // window. 136 // window.
134 virtual void TabBlockedStateChanged(content::WebContents* contents, 137 virtual void TabBlockedStateChanged(content::WebContents* contents,
135 int index); 138 int index);
136 139
137 // The TabStripModel now no longer has any tabs. The implementer may 140 // The TabStripModel now no longer has any tabs. The implementer may
138 // use this as a trigger to try and close the window containing the 141 // use this as a trigger to try and close the window containing the
139 // TabStripModel, for example... 142 // TabStripModel, for example...
140 virtual void TabStripEmpty(); 143 virtual void TabStripEmpty();
141 144
142 // Sent any time an attempt is made to close all the tabs. This is not 145 // Sent any time an attempt is made to close all the tabs. This is not
143 // necessarily the result of CloseAllTabs(). For example, if the user closes 146 // necessarily the result of CloseAllTabs(). For example, if the user closes
144 // the last tab WillCloseAllTabs() is sent. If the close does not succeed 147 // the last tab WillCloseAllTabs() is sent. If the close does not succeed
145 // during the current event (say unload handlers block it) then 148 // during the current event (say unload handlers block it) then
146 // CloseAllTabsCanceled() is sent. Also note that if the last tab is detached 149 // CloseAllTabsCanceled() is sent. Also note that if the last tab is detached
147 // (DetachWebContentsAt()) then this is not sent. 150 // (DetachWebContentsAt()) then this is not sent.
148 virtual void WillCloseAllTabs(); 151 virtual void WillCloseAllTabs();
149 virtual void CloseAllTabsCanceled(); 152 virtual void CloseAllTabsCanceled();
150 153
151 protected: 154 protected:
152 virtual ~TabStripModelObserver() {} 155 virtual ~TabStripModelObserver() {}
153 }; 156 };
154 157
155 #endif // CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_OBSERVER_H_ 158 #endif // CHROME_BROWSER_UI_TABS_TAB_STRIP_MODEL_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698