| 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/process_util.h" | 20 #include "base/process_util.h" |
| 20 #include "chrome/browser/metrics/metrics_log.h" | 21 #include "chrome/browser/metrics/metrics_log.h" |
| 21 #include "chrome/browser/metrics/tracking_synchronizer_observer.h" | 22 #include "chrome/browser/metrics/tracking_synchronizer_observer.h" |
| 22 #include "chrome/common/metrics/metrics_service_base.h" | 23 #include "chrome/common/metrics/metrics_service_base.h" |
| 23 #include "chrome/installer/util/google_update_settings.h" | 24 #include "chrome/installer/util/google_update_settings.h" |
| 24 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
| 25 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
| 26 #include "net/url_request/url_fetcher_delegate.h" | 27 #include "net/url_request/url_fetcher_delegate.h" |
| 27 | 28 |
| 28 #if defined(OS_CHROMEOS) | 29 #if defined(OS_CHROMEOS) |
| 29 #include "chrome/browser/chromeos/external_metrics.h" | 30 #include "chrome/browser/chromeos/external_metrics.h" |
| 30 #endif | 31 #endif |
| 31 | 32 |
| 32 class BookmarkModel; | 33 class BookmarkModel; |
| 33 class BookmarkNode; | 34 class BookmarkNode; |
| 34 class MetricsReportingScheduler; | 35 class MetricsReportingScheduler; |
| 35 class PrefService; | 36 class PrefService; |
| 36 class Profile; | 37 class Profile; |
| 37 class TemplateURLService; | 38 class TemplateURLService; |
| 38 | 39 |
| 39 namespace base { | 40 namespace base { |
| 40 class DictionaryValue; | 41 class DictionaryValue; |
| 42 class EntropyProvider; |
| 41 class MessageLoopProxy; | 43 class MessageLoopProxy; |
| 42 } | 44 } |
| 43 | 45 |
| 44 namespace content { | 46 namespace content { |
| 45 class RenderProcessHost; | 47 class RenderProcessHost; |
| 46 } | 48 } |
| 47 | 49 |
| 48 namespace extensions { | 50 namespace extensions { |
| 49 class ExtensionDownloader; | 51 class ExtensionDownloader; |
| 50 } | 52 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 79 // StartRecordingOnly starts the metrics recording but not reporting, for use | 81 // StartRecordingOnly starts the metrics recording but not reporting, for use |
| 80 // in tests only. | 82 // in tests only. |
| 81 void Start(); | 83 void Start(); |
| 82 void StartRecordingOnly(); | 84 void StartRecordingOnly(); |
| 83 void Stop(); | 85 void Stop(); |
| 84 | 86 |
| 85 // Returns the client ID for this client, or the empty string if metrics | 87 // Returns the client ID for this client, or the empty string if metrics |
| 86 // recording is not currently running. | 88 // recording is not currently running. |
| 87 std::string GetClientId(); | 89 std::string GetClientId(); |
| 88 | 90 |
| 89 // Returns the preferred entropy source used to seed persistent activities | 91 // Returns the preferred entropy provider used to seed persistent activities |
| 90 // based on whether or not metrics reporting will permitted on this client. | 92 // based on whether or not metrics reporting will permitted on this client. |
| 91 // The caller must determine if metrics reporting will be enabled for this | 93 // The caller must determine if metrics reporting will be enabled for this |
| 92 // client and pass that state in as |reporting_will_be_enabled|. If | 94 // client and pass that state in as |reporting_will_be_enabled|. |
| 93 // |reporting_will_be_enabled| is true, this method returns the client ID | 95 // |
| 94 // concatenated with the low entropy source. Otherwise, this method just | 96 // If |reporting_will_be_enabled| is true, this method returns an entropy |
| 95 // returns the low entropy source. Note that this reporting state can not be | 97 // provider that has a high source of entropy, partially based on the client |
| 96 // checked by reporting_active() because this method may need to be called | 98 // ID. Otherwise, an entropy provider that is based on a low entropy source |
| 97 // before the MetricsService needs to be started. | 99 // is returned. |
| 98 std::string GetEntropySource(bool reporting_will_be_enabled); | 100 // |
| 101 // Note that this reporting state can not be checked by reporting_active() |
| 102 // because this method may need to be called before the MetricsService needs |
| 103 // to be started. |
| 104 base::FieldTrial::EntropyProvider* GetEntropyProvider( |
| 105 bool reporting_will_be_enabled); |
| 99 | 106 |
| 100 // Force the client ID to be generated. This is useful in case it's needed | 107 // Force the client ID to be generated. This is useful in case it's needed |
| 101 // before recording. | 108 // before recording. |
| 102 void ForceClientIdCreation(); | 109 void ForceClientIdCreation(); |
| 103 | 110 |
| 104 // At startup, prefs needs to be called with a list of all the pref names and | 111 // At startup, prefs needs to be called with a list of all the pref names and |
| 105 // types we'll be using. | 112 // types we'll be using. |
| 106 static void RegisterPrefs(PrefService* local_state); | 113 static void RegisterPrefs(PrefService* local_state); |
| 107 | 114 |
| 108 // Set up notifications which indicate that a user is performing work. This is | 115 // Set up notifications which indicate that a user is performing work. This is |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 friend bool prerender::IsOmniboxEnabled(Profile* profile); | 514 friend bool prerender::IsOmniboxEnabled(Profile* profile); |
| 508 friend class extensions::ExtensionDownloader; | 515 friend class extensions::ExtensionDownloader; |
| 509 | 516 |
| 510 // Returns true if prefs::kMetricsReportingEnabled is set. | 517 // Returns true if prefs::kMetricsReportingEnabled is set. |
| 511 static bool IsMetricsReportingEnabled(); | 518 static bool IsMetricsReportingEnabled(); |
| 512 | 519 |
| 513 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); | 520 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); |
| 514 }; | 521 }; |
| 515 | 522 |
| 516 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 523 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
| OLD | NEW |