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

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

Issue 103943006: Let MetricsService know about some Android Activities (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Copyright Created 7 years 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 | Annotate | Revision Log
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 11 matching lines...) Expand all
22 #include "chrome/browser/metrics/metrics_log.h" 22 #include "chrome/browser/metrics/metrics_log.h"
23 #include "chrome/browser/metrics/tracking_synchronizer_observer.h" 23 #include "chrome/browser/metrics/tracking_synchronizer_observer.h"
24 #include "chrome/common/metrics/metrics_service_base.h" 24 #include "chrome/common/metrics/metrics_service_base.h"
25 #include "chrome/installer/util/google_update_settings.h" 25 #include "chrome/installer/util/google_update_settings.h"
26 #include "content/public/browser/browser_child_process_observer.h" 26 #include "content/public/browser/browser_child_process_observer.h"
27 #include "content/public/browser/notification_observer.h" 27 #include "content/public/browser/notification_observer.h"
28 #include "content/public/browser/notification_registrar.h" 28 #include "content/public/browser/notification_registrar.h"
29 #include "content/public/browser/user_metrics.h" 29 #include "content/public/browser/user_metrics.h"
30 #include "net/url_request/url_fetcher_delegate.h" 30 #include "net/url_request/url_fetcher_delegate.h"
31 31
32 #if defined(OS_CHROMEOS) 32 #if defined(OS_ANDROID)
33 #include "chrome/browser/android/activity_type_ids.h"
34 #elif defined(OS_CHROMEOS)
33 #include "chrome/browser/chromeos/external_metrics.h" 35 #include "chrome/browser/chromeos/external_metrics.h"
34 #endif 36 #endif
35 37
36 class MetricsReportingScheduler; 38 class MetricsReportingScheduler;
37 class PrefService; 39 class PrefService;
38 class PrefRegistrySimple; 40 class PrefRegistrySimple;
39 class Profile; 41 class Profile;
40 class TemplateURLService; 42 class TemplateURLService;
41 43
42 namespace base { 44 namespace base {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 scoped_ptr<const base::FieldTrial::EntropyProvider> CreateEntropyProvider( 157 scoped_ptr<const base::FieldTrial::EntropyProvider> CreateEntropyProvider(
156 bool reporting_will_be_enabled); 158 bool reporting_will_be_enabled);
157 159
158 // Force the client ID to be generated. This is useful in case it's needed 160 // Force the client ID to be generated. This is useful in case it's needed
159 // before recording. 161 // before recording.
160 void ForceClientIdCreation(); 162 void ForceClientIdCreation();
161 163
162 // At startup, prefs needs to be called with a list of all the pref names and 164 // At startup, prefs needs to be called with a list of all the pref names and
163 // types we'll be using. 165 // types we'll be using.
164 static void RegisterPrefs(PrefRegistrySimple* registry); 166 static void RegisterPrefs(PrefRegistrySimple* registry);
167 #if defined(OS_ANDROID)
168 static void RegisterPrefsAndroid(PrefRegistrySimple* registry);
169 #endif // defined(OS_ANDROID)
165 170
166 // Set up notifications which indicate that a user is performing work. This is 171 // Set up notifications which indicate that a user is performing work. This is
167 // useful to allow some features to sleep, until the machine becomes active, 172 // useful to allow some features to sleep, until the machine becomes active,
168 // such as precluding UMA uploads unless there was recent activity. 173 // such as precluding UMA uploads unless there was recent activity.
169 static void SetUpNotifications(content::NotificationRegistrar* registrar, 174 static void SetUpNotifications(content::NotificationRegistrar* registrar,
170 content::NotificationObserver* observer); 175 content::NotificationObserver* observer);
171 176
172 // Implementation of content::BrowserChildProcessObserver 177 // Implementation of content::BrowserChildProcessObserver
173 virtual void BrowserChildProcessHostConnected( 178 virtual void BrowserChildProcessHostConnected(
174 const content::ChildProcessData& data) OVERRIDE; 179 const content::ChildProcessData& data) OVERRIDE;
175 virtual void BrowserChildProcessCrashed( 180 virtual void BrowserChildProcessCrashed(
176 const content::ChildProcessData& data) OVERRIDE; 181 const content::ChildProcessData& data) OVERRIDE;
177 virtual void BrowserChildProcessInstanceCreated( 182 virtual void BrowserChildProcessInstanceCreated(
178 const content::ChildProcessData& data) OVERRIDE; 183 const content::ChildProcessData& data) OVERRIDE;
179 184
180 // Implementation of content::NotificationObserver 185 // Implementation of content::NotificationObserver
181 virtual void Observe(int type, 186 virtual void Observe(int type,
182 const content::NotificationSource& source, 187 const content::NotificationSource& source,
183 const content::NotificationDetails& details) OVERRIDE; 188 const content::NotificationDetails& details) OVERRIDE;
184 189
185 // Invoked when we get a WM_SESSIONEND. This places a value in prefs that is 190 // Invoked when we get a WM_SESSIONEND. This places a value in prefs that is
186 // reset when RecordCompletedSessionEnd is invoked. 191 // reset when RecordCompletedSessionEnd is invoked.
187 void RecordStartOfSessionEnd(); 192 void RecordStartOfSessionEnd();
188 193
189 // This should be called when the application is shutting down. It records 194 // This should be called when the application is shutting down. It records
190 // that session end was successful. 195 // that session end was successful.
191 void RecordCompletedSessionEnd(); 196 void RecordCompletedSessionEnd();
192 197
198 #if defined(OS_ANDROID)
199 // Called to record launch and crash stats to preferences.
200 void RecordAndroidStabilityPrefs();
201
202 // Called to record histograms.
203 void RecordAndroidStabilityHistograms();
204
205 // Called when the Activity that the user interacts with is swapped out.
206 void OnForegroundActivityChanged(ActivityTypeIds::Type type);
207 #endif // defined(OS_ANDROID)
208
193 #if defined(OS_ANDROID) || defined(OS_IOS) 209 #if defined(OS_ANDROID) || defined(OS_IOS)
194 // Called when the application is going into background mode. 210 // Called when the application is going into background mode.
195 void OnAppEnterBackground(); 211 void OnAppEnterBackground();
196 212
197 // Called when the application is coming out of background mode. 213 // Called when the application is coming out of background mode.
198 void OnAppEnterForeground(); 214 void OnAppEnterForeground();
199 #else 215 #else
200 // Set the dirty flag, which will require a later call to LogCleanShutdown(). 216 // Set the dirty flag, which will require a later call to LogCleanShutdown().
201 static void LogNeedForCleanShutdown(); 217 static void LogNeedForCleanShutdown();
202 #endif // defined(OS_ANDROID) || defined(OS_IOS) 218 #endif // defined(OS_ANDROID) || defined(OS_IOS)
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 return entropy_source_returned_; 344 return entropy_source_returned_;
329 } 345 }
330 346
331 // When we start a new version of Chromium (different from our last run), we 347 // When we start a new version of Chromium (different from our last run), we
332 // need to discard the old crash stats so that we don't attribute crashes etc. 348 // need to discard the old crash stats so that we don't attribute crashes etc.
333 // in the old version to the current version (via current logs). 349 // in the old version to the current version (via current logs).
334 // Without this, a common reason to finally start a new version is to crash 350 // Without this, a common reason to finally start a new version is to crash
335 // the old version (after an autoupdate has arrived), and so we'd bias 351 // the old version (after an autoupdate has arrived), and so we'd bias
336 // initial results towards showing crashes :-(. 352 // initial results towards showing crashes :-(.
337 static void DiscardOldStabilityStats(PrefService* local_state); 353 static void DiscardOldStabilityStats(PrefService* local_state);
354 #if defined(OS_ANDROID)
355 static void DiscardOldStabilityStatsAndroid(PrefService* local_state);
356 #endif // defined(OS_ANDROID)
338 357
339 // Turns recording on or off. 358 // Turns recording on or off.
340 // DisableRecording() also forces a persistent save of logging state (if 359 // DisableRecording() also forces a persistent save of logging state (if
341 // anything has been recorded, or transmitted). 360 // anything has been recorded, or transmitted).
342 void EnableRecording(); 361 void EnableRecording();
343 void DisableRecording(); 362 void DisableRecording();
344 363
345 // If in_idle is true, sets idle_since_last_transmission to true. 364 // If in_idle is true, sets idle_since_last_transmission to true.
346 // If in_idle is false and idle_since_last_transmission_ is true, sets 365 // If in_idle is false and idle_since_last_transmission_ is true, sets
347 // idle_since_last_transmission to false and starts the timer (provided 366 // idle_since_last_transmission to false and starts the timer (provided
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 friend class extensions::ExtensionDownloader; 603 friend class extensions::ExtensionDownloader;
585 friend class extensions::ManifestFetchData; 604 friend class extensions::ManifestFetchData;
586 605
587 // Returns true if prefs::kMetricsReportingEnabled is set. 606 // Returns true if prefs::kMetricsReportingEnabled is set.
588 static bool IsMetricsReportingEnabled(); 607 static bool IsMetricsReportingEnabled();
589 608
590 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); 609 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper);
591 }; 610 };
592 611
593 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ 612 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698