OLD | NEW |
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 |
11 #include <map> | 11 #include <map> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "base/metrics/field_trial.h" | 19 #include "base/metrics/field_trial.h" |
20 #include "base/process_util.h" | 20 #include "base/process_util.h" |
21 #include "chrome/browser/metrics/metrics_log.h" | 21 #include "chrome/browser/metrics/metrics_log.h" |
22 #include "chrome/browser/metrics/tracking_synchronizer_observer.h" | 22 #include "chrome/browser/metrics/tracking_synchronizer_observer.h" |
23 #include "chrome/common/metrics/metrics_service_base.h" | 23 #include "chrome/common/metrics/metrics_service_base.h" |
24 #include "chrome/installer/util/google_update_settings.h" | 24 #include "chrome/installer/util/google_update_settings.h" |
25 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
26 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
| 27 #include "content/public/browser/user_metrics.h" |
27 #include "net/url_request/url_fetcher_delegate.h" | 28 #include "net/url_request/url_fetcher_delegate.h" |
28 | 29 |
29 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) |
30 #include "chrome/browser/chromeos/external_metrics.h" | 31 #include "chrome/browser/chromeos/external_metrics.h" |
31 #endif | 32 #endif |
32 | 33 |
33 class MetricsReportingScheduler; | 34 class MetricsReportingScheduler; |
34 class PrefService; | 35 class PrefService; |
35 class PrefServiceSimple; | 36 class PrefServiceSimple; |
36 class Profile; | 37 class Profile; |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // Task launched by OnInitTaskGotPluginInfo() that continues the init task by | 228 // Task launched by OnInitTaskGotPluginInfo() that continues the init task by |
228 // loading Google Update statistics. Called on a blocking pool thread. | 229 // loading Google Update statistics. Called on a blocking pool thread. |
229 static void InitTaskGetGoogleUpdateData(base::WeakPtr<MetricsService> self, | 230 static void InitTaskGetGoogleUpdateData(base::WeakPtr<MetricsService> self, |
230 base::MessageLoopProxy* target_loop); | 231 base::MessageLoopProxy* target_loop); |
231 | 232 |
232 // Callback from InitTaskGetGoogleUpdateData() that continues the init task by | 233 // Callback from InitTaskGetGoogleUpdateData() that continues the init task by |
233 // loading profiler data. | 234 // loading profiler data. |
234 void OnInitTaskGotGoogleUpdateData( | 235 void OnInitTaskGotGoogleUpdateData( |
235 const GoogleUpdateMetrics& google_update_metrics); | 236 const GoogleUpdateMetrics& google_update_metrics); |
236 | 237 |
| 238 void OnUserAction(const std::string& action); |
| 239 |
237 // TrackingSynchronizerObserver: | 240 // TrackingSynchronizerObserver: |
238 virtual void ReceivedProfilerData( | 241 virtual void ReceivedProfilerData( |
239 const tracked_objects::ProcessDataSnapshot& process_data, | 242 const tracked_objects::ProcessDataSnapshot& process_data, |
240 content::ProcessType process_type) OVERRIDE; | 243 content::ProcessType process_type) OVERRIDE; |
241 // Callback that moves the state to INIT_TASK_DONE. | 244 // Callback that moves the state to INIT_TASK_DONE. |
242 virtual void FinishedReceivingProfilerData() OVERRIDE; | 245 virtual void FinishedReceivingProfilerData() OVERRIDE; |
243 | 246 |
244 // Returns the low entropy source for this client. This is a random value | 247 // Returns the low entropy source for this client. This is a random value |
245 // that is non-identifying amongst browser clients. This method will | 248 // that is non-identifying amongst browser clients. This method will |
246 // generate the entropy source value if it has not been called before. | 249 // generate the entropy source value if it has not been called before. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 382 |
380 // Logs the initiation of a page load | 383 // Logs the initiation of a page load |
381 void LogLoadStarted(); | 384 void LogLoadStarted(); |
382 | 385 |
383 // Records a page load notification. | 386 // Records a page load notification. |
384 void LogLoadComplete(int type, | 387 void LogLoadComplete(int type, |
385 const content::NotificationSource& source, | 388 const content::NotificationSource& source, |
386 const content::NotificationDetails& details); | 389 const content::NotificationDetails& details); |
387 | 390 |
388 // Checks whether a notification can be logged. | 391 // Checks whether a notification can be logged. |
389 bool CanLogNotification(int type, | 392 bool CanLogNotification(); |
390 const content::NotificationSource& source, | |
391 const content::NotificationDetails& details); | |
392 | 393 |
393 // Sets the value of the specified path in prefs and schedules a save. | 394 // Sets the value of the specified path in prefs and schedules a save. |
394 void RecordBooleanPrefValue(const char* path, bool value); | 395 void RecordBooleanPrefValue(const char* path, bool value); |
395 | 396 |
396 // Returns true if process of type |type| should be counted as a plugin | 397 // Returns true if process of type |type| should be counted as a plugin |
397 // process, and false otherwise. | 398 // process, and false otherwise. |
398 static bool IsPluginProcess(content::ProcessType type); | 399 static bool IsPluginProcess(content::ProcessType type); |
399 | 400 |
| 401 content::ActionCallback action_callback_; |
| 402 |
400 content::NotificationRegistrar registrar_; | 403 content::NotificationRegistrar registrar_; |
401 | 404 |
402 // Indicate whether recording and reporting are currently happening. | 405 // Indicate whether recording and reporting are currently happening. |
403 // These should not be set directly, but by calling SetRecording and | 406 // These should not be set directly, but by calling SetRecording and |
404 // SetReporting. | 407 // SetReporting. |
405 bool recording_active_; | 408 bool recording_active_; |
406 bool reporting_active_; | 409 bool reporting_active_; |
407 | 410 |
408 // Indicate whether test mode is enabled, where the initial log should never | 411 // Indicate whether test mode is enabled, where the initial log should never |
409 // be cut, and logs are neither persisted nor uploaded. | 412 // be cut, and logs are neither persisted nor uploaded. |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 friend class extensions::ExtensionDownloader; | 519 friend class extensions::ExtensionDownloader; |
517 friend class extensions::ManifestFetchData; | 520 friend class extensions::ManifestFetchData; |
518 | 521 |
519 // Returns true if prefs::kMetricsReportingEnabled is set. | 522 // Returns true if prefs::kMetricsReportingEnabled is set. |
520 static bool IsMetricsReportingEnabled(); | 523 static bool IsMetricsReportingEnabled(); |
521 | 524 |
522 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); | 525 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); |
523 }; | 526 }; |
524 | 527 |
525 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 528 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
OLD | NEW |