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

Side by Side Diff: chrome/browser/ui/browser_list.cc

Issue 2142983002: Add desktop engagement metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 #include "chrome/browser/ui/browser_list.h" 5 #include "chrome/browser/ui/browser_list.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 content::RecordAction(UserMetricsAction("ActiveBrowserChanged")); 220 content::RecordAction(UserMetricsAction("ActiveBrowserChanged"));
221 221
222 RemoveBrowserFrom(browser, &GetInstance()->last_active_browsers_); 222 RemoveBrowserFrom(browser, &GetInstance()->last_active_browsers_);
223 GetInstance()->last_active_browsers_.push_back(browser); 223 GetInstance()->last_active_browsers_.push_back(browser);
224 224
225 FOR_EACH_OBSERVER(chrome::BrowserListObserver, observers_.Get(), 225 FOR_EACH_OBSERVER(chrome::BrowserListObserver, observers_.Get(),
226 OnBrowserSetLastActive(browser)); 226 OnBrowserSetLastActive(browser));
227 } 227 }
228 228
229 // static 229 // static
230 void BrowserList::NotifyBrowserNoLongerActive(Browser* browser) {
231 FOR_EACH_OBSERVER(chrome::BrowserListObserver, observers_.Get(),
232 OnBrowserNoLongerActive(browser));
233 }
234
235 // static
230 bool BrowserList::IsIncognitoSessionActive() { 236 bool BrowserList::IsIncognitoSessionActive() {
231 for (auto* browser : *BrowserList::GetInstance()) { 237 for (auto* browser : *BrowserList::GetInstance()) {
232 if (browser->profile()->IsOffTheRecord()) 238 if (browser->profile()->IsOffTheRecord())
233 return true; 239 return true;
234 } 240 }
235 return false; 241 return false;
236 } 242 }
237 243
238 // static 244 // static
239 bool BrowserList::IsIncognitoSessionActiveForProfile(Profile* profile) { 245 bool BrowserList::IsIncognitoSessionActiveForProfile(Profile* profile) {
(...skipping 16 matching lines...) Expand all
256 } 262 }
257 263
258 // static 264 // static
259 void BrowserList::RemoveBrowserFrom(Browser* browser, 265 void BrowserList::RemoveBrowserFrom(Browser* browser,
260 BrowserVector* browser_list) { 266 BrowserVector* browser_list) {
261 BrowserVector::iterator remove_browser = 267 BrowserVector::iterator remove_browser =
262 std::find(browser_list->begin(), browser_list->end(), browser); 268 std::find(browser_list->begin(), browser_list->end(), browser);
263 if (remove_browser != browser_list->end()) 269 if (remove_browser != browser_list->end())
264 browser_list->erase(remove_browser); 270 browser_list->erase(remove_browser);
265 } 271 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698