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

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

Issue 290343005: Pass MetricsServiceClient into MetricsService, and create a simple stubbed TestMetricsServiceClient… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 struct WebPluginInfo; 67 struct WebPluginInfo;
68 } 68 }
69 69
70 namespace extensions { 70 namespace extensions {
71 class ExtensionDownloader; 71 class ExtensionDownloader;
72 class ManifestFetchData; 72 class ManifestFetchData;
73 class MetricsPrivateGetIsCrashReportingEnabledFunction; 73 class MetricsPrivateGetIsCrashReportingEnabledFunction;
74 } 74 }
75 75
76 namespace metrics { 76 namespace metrics {
77 class MetricsServiceClient;
77 class MetricsStateManager; 78 class MetricsStateManager;
78 } 79 }
79 80
80 namespace net { 81 namespace net {
81 class URLFetcher; 82 class URLFetcher;
82 } 83 }
83 84
84 namespace prerender { 85 namespace prerender {
85 bool IsOmniboxEnabled(Profile* profile); 86 bool IsOmniboxEnabled(Profile* profile);
86 } 87 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 UNINITIALIZED_PHASE = 0, 126 UNINITIALIZED_PHASE = 0,
126 START_METRICS_RECORDING = 100, 127 START_METRICS_RECORDING = 100,
127 CREATE_PROFILE = 200, 128 CREATE_PROFILE = 200,
128 STARTUP_TIMEBOMB_ARM = 300, 129 STARTUP_TIMEBOMB_ARM = 300,
129 THREAD_WATCHER_START = 400, 130 THREAD_WATCHER_START = 400,
130 MAIN_MESSAGE_LOOP_RUN = 500, 131 MAIN_MESSAGE_LOOP_RUN = 500,
131 SHUTDOWN_TIMEBOMB_ARM = 600, 132 SHUTDOWN_TIMEBOMB_ARM = 600,
132 SHUTDOWN_COMPLETE = 700, 133 SHUTDOWN_COMPLETE = 700,
133 }; 134 };
134 135
135 // Creates the MetricsService with the given |state_manager|. Does not take 136 // Creates the MetricsService with the given |state_manager| and |client|.
136 // ownership of |state_manager|, instead stores a weak pointer to it. Caller 137 // Does not take ownership of |state_manager| or |client|; instead stores a
137 // should ensure that |state_manager| is valid for the lifetime of this class. 138 // weak pointer to each. Caller should ensure that |state_manager| and
138 explicit MetricsService(metrics::MetricsStateManager* state_manager); 139 // |client| are valid for the lifetime of this class.
140 MetricsService(metrics::MetricsStateManager* state_manager,
141 metrics::MetricsServiceClient* client);
139 virtual ~MetricsService(); 142 virtual ~MetricsService();
140 143
141 // Initializes metrics recording state. Updates various bookkeeping values in 144 // Initializes metrics recording state. Updates various bookkeeping values in
142 // prefs and sets up the scheduler. This is a separate function rather than 145 // prefs and sets up the scheduler. This is a separate function rather than
143 // being done by the constructor so that field trials could be created before 146 // being done by the constructor so that field trials could be created before
144 // this is run. 147 // this is run.
145 void InitializeMetricsRecordingState(); 148 void InitializeMetricsRecordingState();
146 149
147 // Starts the metrics system, turning on recording and uploading of metrics. 150 // Starts the metrics system, turning on recording and uploading of metrics.
148 // Should be called when starting up with metrics enabled, or when metrics 151 // Should be called when starting up with metrics enabled, or when metrics
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 // process, and false otherwise. 483 // process, and false otherwise.
481 static bool IsPluginProcess(int process_type); 484 static bool IsPluginProcess(int process_type);
482 485
483 // Returns a list of synthetic field trials that were active for the entire 486 // Returns a list of synthetic field trials that were active for the entire
484 // duration of the current log. 487 // duration of the current log.
485 void GetCurrentSyntheticFieldTrials( 488 void GetCurrentSyntheticFieldTrials(
486 std::vector<variations::ActiveGroupId>* synthetic_trials); 489 std::vector<variations::ActiveGroupId>* synthetic_trials);
487 490
488 // Used to manage various metrics reporting state prefs, such as client id, 491 // Used to manage various metrics reporting state prefs, such as client id,
489 // low entropy source and whether metrics reporting is enabled. Weak pointer. 492 // low entropy source and whether metrics reporting is enabled. Weak pointer.
490 metrics::MetricsStateManager* state_manager_; 493 metrics::MetricsStateManager* const state_manager_;
494
495 // Used to interact with the embedder. Weak pointer; must outlive |this|
496 // instance.
497 metrics::MetricsServiceClient* const client_;
491 498
492 // Registered metrics providers. 499 // Registered metrics providers.
493 ScopedVector<metrics::MetricsProvider> metrics_providers_; 500 ScopedVector<metrics::MetricsProvider> metrics_providers_;
494 501
495 base::ActionCallback action_callback_; 502 base::ActionCallback action_callback_;
496 503
497 content::NotificationRegistrar registrar_; 504 content::NotificationRegistrar registrar_;
498 505
499 // Set to true when |ResetMetricsIDsIfNecessary| is called for the first time. 506 // Set to true when |ResetMetricsIDsIfNecessary| is called for the first time.
500 // This prevents multiple resets within the same Chrome session. 507 // This prevents multiple resets within the same Chrome session.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 647
641 // Registers/unregisters |observer| to receive MetricsLog notifications 648 // Registers/unregisters |observer| to receive MetricsLog notifications
642 // from metrics service. 649 // from metrics service.
643 static void AddMetricsServiceObserver(MetricsServiceObserver* observer); 650 static void AddMetricsServiceObserver(MetricsServiceObserver* observer);
644 static void RemoveMetricsServiceObserver(MetricsServiceObserver* observer); 651 static void RemoveMetricsServiceObserver(MetricsServiceObserver* observer);
645 652
646 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); 653 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper);
647 }; 654 };
648 655
649 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ 656 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/metrics/chrome_metrics_service_client.cc ('k') | chrome/browser/metrics/metrics_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698