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

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

Issue 2771233002: Remove the wrapper functions content::RecordAction et al (Closed)
Patch Set: Rebased Created 3 years, 8 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"
11 #include "base/metrics/user_metrics.h"
11 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/browser_shutdown.h" 13 #include "chrome/browser/browser_shutdown.h"
13 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
14 #include "chrome/browser/lifetime/application_lifetime.h" 15 #include "chrome/browser/lifetime/application_lifetime.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_finder.h" 18 #include "chrome/browser/ui/browser_finder.h"
18 #include "chrome/browser/ui/browser_list_observer.h" 19 #include "chrome/browser/ui/browser_list_observer.h"
19 #include "chrome/browser/ui/browser_window.h" 20 #include "chrome/browser/ui/browser_window.h"
20 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
21 #include "content/public/browser/user_metrics.h"
22 22
23 using base::UserMetricsAction; 23 using base::UserMetricsAction;
24 using content::WebContents; 24 using content::WebContents;
25 25
26 namespace { 26 namespace {
27 27
28 BrowserList::BrowserVector GetBrowsersToClose(Profile* profile) { 28 BrowserList::BrowserVector GetBrowsersToClose(Profile* profile) {
29 BrowserList::BrowserVector browsers_to_close; 29 BrowserList::BrowserVector browsers_to_close;
30 for (auto* browser : *BrowserList::GetInstance()) { 30 for (auto* browser : *BrowserList::GetInstance()) {
31 if (browser->profile()->GetOriginalProfile() == 31 if (browser->profile()->GetOriginalProfile() ==
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 Browser* new_last_active = instance->GetLastActive(); 227 Browser* new_last_active = instance->GetLastActive();
228 if (old_last_active != new_last_active) { 228 if (old_last_active != new_last_active) {
229 for (chrome::BrowserListObserver& observer : observers_.Get()) 229 for (chrome::BrowserListObserver& observer : observers_.Get())
230 observer.OnBrowserSetLastActive(new_last_active); 230 observer.OnBrowserSetLastActive(new_last_active);
231 } 231 }
232 } 232 }
233 233
234 // static 234 // static
235 void BrowserList::SetLastActive(Browser* browser) { 235 void BrowserList::SetLastActive(Browser* browser) {
236 content::RecordAction(UserMetricsAction("ActiveBrowserChanged")); 236 base::RecordAction(UserMetricsAction("ActiveBrowserChanged"));
237 237
238 RemoveBrowserFrom(browser, &GetInstance()->last_active_browsers_); 238 RemoveBrowserFrom(browser, &GetInstance()->last_active_browsers_);
239 GetInstance()->last_active_browsers_.push_back(browser); 239 GetInstance()->last_active_browsers_.push_back(browser);
240 240
241 for (chrome::BrowserListObserver& observer : observers_.Get()) 241 for (chrome::BrowserListObserver& observer : observers_.Get())
242 observer.OnBrowserSetLastActive(browser); 242 observer.OnBrowserSetLastActive(browser);
243 } 243 }
244 244
245 // static 245 // static
246 void BrowserList::NotifyBrowserNoLongerActive(Browser* browser) { 246 void BrowserList::NotifyBrowserNoLongerActive(Browser* browser) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 278 }
279 279
280 // static 280 // static
281 void BrowserList::RemoveBrowserFrom(Browser* browser, 281 void BrowserList::RemoveBrowserFrom(Browser* browser,
282 BrowserVector* browser_list) { 282 BrowserVector* browser_list) {
283 BrowserVector::iterator remove_browser = 283 BrowserVector::iterator remove_browser =
284 std::find(browser_list->begin(), browser_list->end(), browser); 284 std::find(browser_list->begin(), browser_list->end(), browser);
285 if (remove_browser != browser_list->end()) 285 if (remove_browser != browser_list->end())
286 browser_list->erase(remove_browser); 286 browser_list->erase(remove_browser);
287 } 287 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_instant_controller.cc ('k') | chrome/browser/ui/browser_tab_restorer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698