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

Side by Side Diff: chrome/browser/metrics/page_load_metrics_provider.cc

Issue 2189543002: Notify page load metrics when the app enters the background. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clankbackgroundcallback
Patch Set: fix histogram description Created 4 years, 4 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/metrics/page_load_metrics_provider.h"
6
7 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h"
8 #include "chrome/browser/ui/android/tab_model/tab_model.h"
9 #include "chrome/browser/ui/android/tab_model/tab_model_list.h"
10
11 PageLoadMetricsProvider::PageLoadMetricsProvider() {}
12
13 PageLoadMetricsProvider::~PageLoadMetricsProvider() {}
14
15 void PageLoadMetricsProvider::OnAppEnterBackground() {
16 for (TabModelList::const_iterator it = TabModelList::begin();
17 it != TabModelList::end(); ++it) {
18 TabModel* model = *it;
19 for (int tab_index = 0; tab_index < model->GetTabCount(); ++tab_index) {
20 content::WebContents* web_contents = model->GetWebContentsAt(tab_index);
21 if (!web_contents)
22 continue;
23 page_load_metrics::MetricsWebContentsObserver* observer =
24 page_load_metrics::MetricsWebContentsObserver::FromWebContents(
25 web_contents);
26 if (observer)
27 observer->FlushMetricsOnAppEnterBackground();
28 }
29 }
30 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/page_load_metrics_provider.h ('k') | chrome/browser/page_load_metrics/metrics_web_contents_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698