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

Unified Diff: chrome/browser/metrics/metrics_service.h

Issue 282093012: Remove dependencies of Metrics{Service,Log} on g_browser_process->local_state() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove cruft Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/metrics/metrics_service.h
diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h
index 9a52d030de221a0be1d42ef921d280c8967ef13e..dd30b7c5c0a0a5436e866d09b64151fed66031d1 100644
--- a/chrome/browser/metrics/metrics_service.h
+++ b/chrome/browser/metrics/metrics_service.h
@@ -54,6 +54,7 @@ class FlashDOMHandler;
namespace base {
class DictionaryValue;
class MessageLoopProxy;
+class PrefService;
}
namespace chrome_variations {
@@ -131,10 +132,12 @@ class MetricsService
SHUTDOWN_COMPLETE = 700,
};
- // Creates the MetricsService with the given |state_manager|. Does not take
- // ownership of |state_manager|, instead stores a weak pointer to it. Caller
- // should ensure that |state_manager| is valid for the lifetime of this class.
- explicit MetricsService(metrics::MetricsStateManager* state_manager);
+ // Creates the MetricsService with the given |state_manager| and
+ // |local_state|. Does not take ownership of the parameters, instead stores
+ // weak pointers. Caller should ensure that the passed-in objects are valid
+ // for the lifetime of this class.
+ MetricsService(metrics::MetricsStateManager* state_manager,
+ PrefService* local_state);
virtual ~MetricsService();
// Initializes metrics recording state. Updates various bookkeeping values in
@@ -235,10 +238,11 @@ class MetricsService
void OnAppEnterForeground();
#else
// Set the dirty flag, which will require a later call to LogCleanShutdown().
- static void LogNeedForCleanShutdown();
+ static void LogNeedForCleanShutdown(PrefService* local_state);
#endif // defined(OS_ANDROID) || defined(OS_IOS)
- static void SetExecutionPhase(ExecutionPhase execution_phase);
+ static void SetExecutionPhase(ExecutionPhase execution_phase,
+ PrefService* local_state);
// Saves in the preferences if the crash report registration was successful.
// This count is eventually send via UMA logs.
@@ -487,6 +491,8 @@ class MetricsService
// low entropy source and whether metrics reporting is enabled. Weak pointer.
metrics::MetricsStateManager* state_manager_;
+ PrefService* local_state_;
+
base::ActionCallback action_callback_;
content::NotificationRegistrar registrar_;
@@ -631,12 +637,12 @@ class MetricsServiceHelper {
// TODO(asvitkine): Consolidate the method in MetricsStateManager.
// TODO(asvitkine): This function does not report the correct value on
// Android and ChromeOS, see http://crbug.com/362192.
- static bool IsMetricsReportingEnabled();
+ static bool IsMetricsReportingEnabled(const PrefService* local_state);
Alexei Svitkine (slow) 2014/05/19 13:13:54 Hmm, so we have a separate bug to move MetricsServ
blundell 2014/05/19 13:49:28 Are we not going to need to access this API from t
Alexei Svitkine (slow) 2014/05/19 13:53:44 Not quite. The idea is that the implementation sho
// Returns true if crash reporting is enabled. This is set at the platform
// level for Android and ChromeOS, and otherwise is the same as
// IsMetricsReportingEnabled for desktop Chrome.
- static bool IsCrashReportingEnabled();
+ static bool IsCrashReportingEnabled(const PrefService* local_state);
// Registers/unregisters |observer| to receive MetricsLog notifications
// from metrics service.

Powered by Google App Engine
This is Rietveld 408576698