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

Side by Side Diff: chrome/browser/metrics/metrics_service.h

Issue 137623002: Let MetricsService know about some Android Activities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 10 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 // This file defines a service that collects information about the user 5 // This file defines a service that collects information about the user
6 // experience in order to help improve future versions of the app. 6 // experience in order to help improve future versions of the app.
7 7
8 #ifndef CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ 8 #ifndef CHROME_BROWSER_METRICS_METRICS_SERVICE_H_
9 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ 9 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_H_
10 10
(...skipping 12 matching lines...) Expand all
23 #include "chrome/browser/metrics/metrics_log.h" 23 #include "chrome/browser/metrics/metrics_log.h"
24 #include "chrome/browser/metrics/tracking_synchronizer_observer.h" 24 #include "chrome/browser/metrics/tracking_synchronizer_observer.h"
25 #include "chrome/common/metrics/metrics_service_base.h" 25 #include "chrome/common/metrics/metrics_service_base.h"
26 #include "chrome/installer/util/google_update_settings.h" 26 #include "chrome/installer/util/google_update_settings.h"
27 #include "content/public/browser/browser_child_process_observer.h" 27 #include "content/public/browser/browser_child_process_observer.h"
28 #include "content/public/browser/notification_observer.h" 28 #include "content/public/browser/notification_observer.h"
29 #include "content/public/browser/notification_registrar.h" 29 #include "content/public/browser/notification_registrar.h"
30 #include "content/public/browser/user_metrics.h" 30 #include "content/public/browser/user_metrics.h"
31 #include "net/url_request/url_fetcher_delegate.h" 31 #include "net/url_request/url_fetcher_delegate.h"
32 32
33 #if defined(OS_CHROMEOS) 33 #if defined(OS_ANDROID)
34 #include "chrome/browser/android/activity_type_ids.h"
35 #elif defined(OS_CHROMEOS)
34 #include "chrome/browser/chromeos/external_metrics.h" 36 #include "chrome/browser/chromeos/external_metrics.h"
35 #endif 37 #endif
36 38
37 class MetricsReportingScheduler; 39 class MetricsReportingScheduler;
38 class PrefService; 40 class PrefService;
39 class PrefRegistrySimple; 41 class PrefRegistrySimple;
40 class Profile; 42 class Profile;
41 class TemplateURLService; 43 class TemplateURLService;
42 44
43 namespace base { 45 namespace base {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 scoped_ptr<const base::FieldTrial::EntropyProvider> CreateEntropyProvider( 170 scoped_ptr<const base::FieldTrial::EntropyProvider> CreateEntropyProvider(
169 ReportingState reporting_state); 171 ReportingState reporting_state);
170 172
171 // Force the client ID to be generated. This is useful in case it's needed 173 // Force the client ID to be generated. This is useful in case it's needed
172 // before recording. 174 // before recording.
173 void ForceClientIdCreation(); 175 void ForceClientIdCreation();
174 176
175 // At startup, prefs needs to be called with a list of all the pref names and 177 // At startup, prefs needs to be called with a list of all the pref names and
176 // types we'll be using. 178 // types we'll be using.
177 static void RegisterPrefs(PrefRegistrySimple* registry); 179 static void RegisterPrefs(PrefRegistrySimple* registry);
180 #if defined(OS_ANDROID)
181 static void RegisterPrefsAndroid(PrefRegistrySimple* registry);
182 #endif // defined(OS_ANDROID)
178 183
179 // Set up notifications which indicate that a user is performing work. This is 184 // Set up notifications which indicate that a user is performing work. This is
180 // useful to allow some features to sleep, until the machine becomes active, 185 // useful to allow some features to sleep, until the machine becomes active,
181 // such as precluding UMA uploads unless there was recent activity. 186 // such as precluding UMA uploads unless there was recent activity.
182 static void SetUpNotifications(content::NotificationRegistrar* registrar, 187 static void SetUpNotifications(content::NotificationRegistrar* registrar,
183 content::NotificationObserver* observer); 188 content::NotificationObserver* observer);
184 189
185 // Implementation of content::BrowserChildProcessObserver 190 // Implementation of content::BrowserChildProcessObserver
186 virtual void BrowserChildProcessHostConnected( 191 virtual void BrowserChildProcessHostConnected(
187 const content::ChildProcessData& data) OVERRIDE; 192 const content::ChildProcessData& data) OVERRIDE;
188 virtual void BrowserChildProcessCrashed( 193 virtual void BrowserChildProcessCrashed(
189 const content::ChildProcessData& data) OVERRIDE; 194 const content::ChildProcessData& data) OVERRIDE;
190 virtual void BrowserChildProcessInstanceCreated( 195 virtual void BrowserChildProcessInstanceCreated(
191 const content::ChildProcessData& data) OVERRIDE; 196 const content::ChildProcessData& data) OVERRIDE;
192 197
193 // Implementation of content::NotificationObserver 198 // Implementation of content::NotificationObserver
194 virtual void Observe(int type, 199 virtual void Observe(int type,
195 const content::NotificationSource& source, 200 const content::NotificationSource& source,
196 const content::NotificationDetails& details) OVERRIDE; 201 const content::NotificationDetails& details) OVERRIDE;
197 202
198 // Invoked when we get a WM_SESSIONEND. This places a value in prefs that is 203 // Invoked when we get a WM_SESSIONEND. This places a value in prefs that is
199 // reset when RecordCompletedSessionEnd is invoked. 204 // reset when RecordCompletedSessionEnd is invoked.
200 void RecordStartOfSessionEnd(); 205 void RecordStartOfSessionEnd();
201 206
202 // This should be called when the application is shutting down. It records 207 // This should be called when the application is shutting down. It records
203 // that session end was successful. 208 // that session end was successful.
204 void RecordCompletedSessionEnd(); 209 void RecordCompletedSessionEnd();
205 210
211 #if defined(OS_ANDROID)
212 // Called to log launch and crash stats to preferences.
213 void LogAndroidStabilityToPrefs(PrefService* pref);
214
215 // Converts crash stats stored in the preferences into histograms.
216 void ConvertAndroidStabilityPrefsToHistograms(PrefService* pref);
217
218 // Called when the Activity that the user interacts with is swapped out.
219 void OnForegroundActivityChanged(PrefService* pref,
220 ActivityTypeIds::Type type);
221 #endif // defined(OS_ANDROID)
222
206 #if defined(OS_ANDROID) || defined(OS_IOS) 223 #if defined(OS_ANDROID) || defined(OS_IOS)
207 // Called when the application is going into background mode. 224 // Called when the application is going into background mode.
208 void OnAppEnterBackground(); 225 void OnAppEnterBackground();
209 226
210 // Called when the application is coming out of background mode. 227 // Called when the application is coming out of background mode.
211 void OnAppEnterForeground(); 228 void OnAppEnterForeground();
212 #else 229 #else
213 // Set the dirty flag, which will require a later call to LogCleanShutdown(). 230 // Set the dirty flag, which will require a later call to LogCleanShutdown().
214 static void LogNeedForCleanShutdown(); 231 static void LogNeedForCleanShutdown();
215 #endif // defined(OS_ANDROID) || defined(OS_IOS) 232 #endif // defined(OS_ANDROID) || defined(OS_IOS)
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 return entropy_source_returned_; 356 return entropy_source_returned_;
340 } 357 }
341 358
342 // When we start a new version of Chromium (different from our last run), we 359 // When we start a new version of Chromium (different from our last run), we
343 // need to discard the old crash stats so that we don't attribute crashes etc. 360 // need to discard the old crash stats so that we don't attribute crashes etc.
344 // in the old version to the current version (via current logs). 361 // in the old version to the current version (via current logs).
345 // Without this, a common reason to finally start a new version is to crash 362 // Without this, a common reason to finally start a new version is to crash
346 // the old version (after an autoupdate has arrived), and so we'd bias 363 // the old version (after an autoupdate has arrived), and so we'd bias
347 // initial results towards showing crashes :-(. 364 // initial results towards showing crashes :-(.
348 static void DiscardOldStabilityStats(PrefService* local_state); 365 static void DiscardOldStabilityStats(PrefService* local_state);
366 #if defined(OS_ANDROID)
367 static void DiscardOldStabilityStatsAndroid(PrefService* local_state);
368 #endif // defined(OS_ANDROID)
349 369
350 // Turns recording on or off. 370 // Turns recording on or off.
351 // DisableRecording() also forces a persistent save of logging state (if 371 // DisableRecording() also forces a persistent save of logging state (if
352 // anything has been recorded, or transmitted). 372 // anything has been recorded, or transmitted).
353 void EnableRecording(); 373 void EnableRecording();
354 void DisableRecording(); 374 void DisableRecording();
355 375
356 // If in_idle is true, sets idle_since_last_transmission to true. 376 // If in_idle is true, sets idle_since_last_transmission to true.
357 // If in_idle is false and idle_since_last_transmission_ is true, sets 377 // If in_idle is false and idle_since_last_transmission_ is true, sets
358 // idle_since_last_transmission to false and starts the timer (provided 378 // idle_since_last_transmission to false and starts the timer (provided
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 friend class extensions::ExtensionDownloader; 627 friend class extensions::ExtensionDownloader;
608 friend class extensions::ManifestFetchData; 628 friend class extensions::ManifestFetchData;
609 629
610 // Returns true if prefs::kMetricsReportingEnabled is set. 630 // Returns true if prefs::kMetricsReportingEnabled is set.
611 static bool IsMetricsReportingEnabled(); 631 static bool IsMetricsReportingEnabled();
612 632
613 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); 633 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper);
614 }; 634 };
615 635
616 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ 636 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698